1 Reply Latest reply on May 15, 2013 5:34 AM by duncancumming



      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>





      Now() : {ts '2013-05-15 12:56:27'}

      LSIsDate(Now()): YES


      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???????

        • 1. Re: LSParseDateTime
          duncancumming Level 3

          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.