Copy link to clipboard
Copied
I have a Problem with parsing dates.
Why does #LSParseDateTime(Now())# produce an error while #LSIsDate(Now())# answers with 'YES' ? locale is German (Standard)
My ColdFusion Code:
Now() : #Now()# <br> | |
LSIsDate(Now()): #LSIsDate(Now())# <br> | |
LSParseDateTime(Now()): #LSParseDateTime(Now())# <br> |
Output:
Now() : {ts '2013-05-15 12:56:27'}
LSIsDate(Now()): YES
LSParseDateTime(Now()):
The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.
{ts '2013-05-15 12:56:27'} is an invalid date or time string. | |
The error occurred in E:\InetPub\wwwroot\tests\OP\emptime.cfm: line 71 | |
69 : Now() : #Now()# <br> |
How can this be and how to solve this problem???????
Copy link to clipboard
Copied
Now() returns a date object. LSParseDateTime expects a string that looks like a date as expressed in your current locale, e.g. "31-12-2013" or "12-31-2013" etc.
What are you trying to do? - as Now() is already a date object, there's no reason I can see why you'd use ParseDateTime / LSParseDateTime to try and convert it into a date.