Page 1 of 1

TimeStamp To Date Conversion

Posted: Thu Jun 19, 2008 2:36 pm
by QuestExpert
Hey,
I am geting TimeStamp "2008-06-18 10:34:51"from Oracle Table Field, but I want to compare it with a Date Field "2008-06-18", which does not have Time attached,
How can I convert and compare these two dates,

Posted: Thu Jun 19, 2008 2:46 pm
by DSguru2B
Extract everything before the first space from your timestamp using the FIELD() function and then compare.

TimStamp to Date

Posted: Thu Jun 19, 2008 5:09 pm
by QuestExpert
Can you provide some more info. please
like what will be the Syntax?
DSguru2B wrote:Extract everything before the first space from your timestamp using the FIELD() function and then compare.

Posted: Thu Jun 19, 2008 6:51 pm
by chulett
Compare the two directly as strings. Use the substring operator [] to hack off the first ten characters of the timestamp when you do:

Code: Select all

If Link.Timestamp[1,10] > Link.Date Then...
Or Field(). :wink:

Re: TimStamp to Date

Posted: Fri Jun 20, 2008 1:41 pm
by vivekgadwal
QuestExpert wrote:Can you provide some more info. please
like what will be the Syntax?
DSguru2B wrote:Extract everything before the first space from your timestamp using the FIELD() function and then compare.
QuestExpert,

You should be having DataStage installed. Go to HELP and search Field() function. It is pretty straight forward!! You can also use Craig's solution too.