Page 1 of 1

Extract Date and Time from TimeStamp Column

Posted: Mon Jan 13, 2014 12:31 pm
by lna_dsuser
Hi,

I have a requirement where I need to Extract the "Date" and "Time" Value from timestamps column..

Column "C" is Defined DataType as TimeStamp and has value as "2013-09-21 21:22:22" I need to get Date in Column "A" (DataType = Date) and Time in Column "B" (DataType = Time).
This is what I did :

A = field(C," ",1) = 2012-09-21
B = field(C," ",2) = 21:22:22

I am able to populate Column "A" and "B" with respective Date and Time Value as mentioned above. "

The value coming in "A" is a sting and is successfully getting populated to Date Column "A". I can convert the Sting to Date by using "StingtoDate" function as well and same I can do for Time Column "B"

My question is that is this the best approach and will give optimal performance and will not cause any issue or I can use other method or function to do this.... I am doing this is DS8.1...

I would appreciate, if somebody can advise on this....

Posted: Mon Jan 13, 2014 2:53 pm
by chulett
Can't check right now but I seem to recall a 'date from timestamp' function as well as a 'time from timestamp' one.

Posted: Mon Jan 13, 2014 3:21 pm
by lna_dsuser
Thanks Craig for your reply..The function is "TimeStamptoDate" and "TimeStamptoTime" function....Is that the best option then using "Field"...

Posted: Mon Jan 13, 2014 3:36 pm
by chulett
Yes. Only use a 'generic' function when there isn't a specific / dedicated one for the task.

Posted: Mon Jan 13, 2014 4:22 pm
by lna_dsuser
Thanks !!!! Appreciate your help.....