Formatting a Date Field

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
daniel
Junior Coder
Posts: 32
Joined: Mon Apr 25, 2005 5:04 pm

Formatting a Date Field

Post by daniel » Mon Jan 26, 2009 8:29 pm

I have a date field that can either be mm/dd/yyyy or mm/dd/yy and in either case i want to convert this to a string of mmddyy. Is there a formatting date option that i can use?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Jan 26, 2009 9:38 pm

Is it text? If so you can do this:

Code: Select all

//Works with 01/31/2009 or 01/31/09 dates
Let>mydate=01/31/2009
StringReplace>mydate,/,,date2
Len>date2,mylen
If>mylen=6
Let>newdate=date2
Goto>alldone
EndIf
Midstr>date2,1,4,newdate
Midstr>date2,7,2,yy
ConCat>newdate,yy
Label>alldone
MDL>newdate
If you are going to eventually sort/index by the dates then yyyymmdd is a more useful format.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts