Skip to main content
Participant
May 15, 2013
Question

LSParseDateTime

  • May 15, 2013
  • 1 reply
  • 465 views

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> 
70 :       LSIsDate(Now()): #LSIsDate(Now())# <br>
71 :       LSParseDateTime(Now()): #LSParseDateTime(Now())# <br>
72 : 

How can this be and how to solve this problem???????

This topic has been closed for replies.

1 reply

Participating Frequently
May 15, 2013

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.