rob
rob

Reputation: 734

How to format this date as a string

Here is my scenario. I am getting this date from a database:

11-AUG-15 10.38.00.000000000 AM

Is there any way to format this string to look something similar to mm/dd/yy?

So far I have tried the following with no luck:

Every time I use one of the above, I get the following error:

11-AUG-15 10.38.00.000000000 AM is an invalid date or time string.

Any advise will be greatly appreciated.

Thanks!

Upvotes: 1

Views: 361

Answers (1)

Henry
Henry

Reputation: 32915

parseDateTime("11-AUG-15 10.38.00.000000000 AM", "dd-MMM-yy hh.mm.ss.S aa");

Run me: http://trycf.com/gist/aac6d63777ae1b0e9aa3/acf?theme=monokai

Then you are free to use DateFormat() or DateTimeFormat()to format the date object.

Upvotes: 2

Related Questions