Page 1 of 1

Timestamp comparision

Posted: Sat Aug 28, 2010 2:51 pm
by ravitell1
Hello all,

I have a timestamp coming as" 2008-10-21 13:14:44.997187"

need to check that 2008 is numeric or not...


Please help me..

Posted: Sat Aug 28, 2010 2:55 pm
by chulett
Why not just use the IsValid function and see if it is a valid timestamp or not. Ah... Server... Ray Wurlod has a Server version freely available from his website, from what I recall.

Posted: Sat Aug 28, 2010 3:11 pm
by ravitell1
thanks for the speedy response..


Actually i need to convert the above timestamp format to mmddyyyy..
then i need to compare whether the yyyy is numeric or not...

Posted: Sat Aug 28, 2010 4:41 pm
by ray.wurlod

Code: Select all

Left(Trim(InLink.TheTimestamp),4) Matches "4N"
will test for yyyy consisting of four numeric characters.

You can use a mix of Iconv() and Oconv() functions to change the format. Please advise your exact output format requirement.

Posted: Sat Aug 28, 2010 4:56 pm
by ravitell1
how to convert the timestamp to date..
Need to convert "2008-10-21 13:14:44.997187" to the format MMDDYYYY
and then check whether yyyy is numeric or not...

Posted: Sat Aug 28, 2010 6:33 pm
by chulett
What is your target? MMDDYYYY is not a DATE data type so you may in fact need something else, that or you may just need to substring off the date from the time.

Posted: Sun Aug 29, 2010 1:52 am
by ray.wurlod
What do you want to do with the time component of the timestamp?

What is the data type of the target? Assuming it's a string of some kind, then one answer is

Code: Select all

Oconv(Iconv(Field(InLink.TheTimestamp, " ", 1, 1), "DYMD"), "DMDY[2,2,4]" : @VM : "MCN")

Posted: Sun Aug 29, 2010 11:27 am
by ravitell1
The Senario is i need to convert the timestamp to MMDDYYYY and check the YYYY is numeric or not
If numeric send MMDDYYYY else send space
... to a seqential file...which in turn used to load into warehouse..

Posted: Sun Aug 29, 2010 12:27 pm
by ray.wurlod
I have provided everything you need except the If..Then..Else construct.

Posted: Sun Aug 29, 2010 1:11 pm
by ravitell1
ray.wurlod wrote:I have provided everything you need except the If..Then..Else construct. ...
Thanks it worked...