Converting a Date

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
Charlie_Epes_(Guest)
Posts: 2
Joined: Tue Oct 10, 2017 12:44 pm

Converting a Date

Post by Charlie_Epes_(Guest) » Thu Feb 05, 2004 6:13 pm

My database vendor changed its dates, as the Year 2000 approached, to read (for example) A10221 for 2001-02-21. The A represents "200" and the digit to the right of the "A" is the 1 in 2001. Do you know how I can convert this type of date to read like a normal "21-February-2001" or some other friendlier date format?

kfleming
Posts: 5795
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: Converting a Date

Post by kfleming » Fri Feb 06, 2004 8:25 am

You would use the SUBS()function to extract each part of the date and then use the CTOD() function to turn that string back to a character. the expression:____CTOD(SUBS(BASE,3,2)+"/"+SUBS(BASE,5,2)+"/"+__STR(IIF(LEFT(BASE,1)="A",2000,1900)+VAL(SUBS(BASE,2,1)),4))____will return a date field from that you can then format in any of the available date formats.____In this expression you would replace BASE with the actual name of your database field. The calculation also assumes that any non-A initial character means a year in the 1900^s so you might also need to revise that part if that is not the case.____Kathleen__R&R Support__

Charlie_Epes_(Guest)
Posts: 2
Joined: Tue Oct 10, 2017 12:44 pm

==> RE: Converting a Date

Post by Charlie_Epes_(Guest) » Fri Feb 06, 2004 9:03 pm

Kathleen, you^re a Wizard! Thank you-

Post Reply