Page 1 of 1

Datetime on Sequential File

Posted: Wed Mar 25, 2009 4:21 pm
by kld05
I have a value of Mar 23 2009 12:00AM on a sequentual file that I need to convert to 20090323 format. I'm wondering what the best approach is. String manipulation or date conversion functions.

Thanks in advance guys.

Posted: Wed Mar 25, 2009 4:43 pm
by Kryt0n
Unless DS has been messing me around, you can't do date manipulation unless the field is in the date format specified by your project, which I suspect will require string manipulation first...

Of course, if your project specifies date format as MMM DD YYYY then I guess you are already halfway there

Re: Datetime on Sequential File

Posted: Wed Mar 25, 2009 5:32 pm
by betterthanever
are you writing file to file??? or from file to a DB table???

Posted: Wed Mar 25, 2009 6:55 pm
by chulett
When you say "on" a sequential file, do you actually mean *in* a sequential file? You won't be able to do pure "string manipulation" as you can't just rearrange the original value to get the desired result. So, hack off the time and then use the normal "date conversion functions" for the rest.

Posted: Wed Mar 25, 2009 8:51 pm
by ray.wurlod
Conversion functions StringToTimestamp(), TimestampToDate() and DateToString() should do it.