Author Topic: hh and HH in datetime format string  (Read 2426 times)

xtradev

  • Newbie
  • *
  • Posts: 9
    • View Profile
hh and HH in datetime format string
« on: May 24, 2015, 09:10:26 am »
I wanted to parse a string as date and time =datetime("2015_01_01 13:02:53","yyyy_MM_dd hh:mm:ss") and got an error:
Quote
Expression: datetime("2015_01_01 13:02:53","yyyy_MM_dd hh:mm:ss")CenterdatetimeUnparseable date: "2015_01_01 13:02:53"

Through trial and error I understood the reason:
Function Reference -> datetime() and Function Reference -> millisecond()
both specify hh as the format for parsing hours,
but Function Reference -> deq() mentions HH in an example.

By specifying =datetime("2015_01_01 13:02:53","yyyy_MM_dd HH:mm:ss") I got it parsed correctly.
This could be an inconsistency in the reference.


I think the following naming conventions would look more consistent:
yyyy,mm,dd,HH,MM,SS,sss
or
YYYY,MM,DD,hh,mm,ss,SSS
instead of
yyyy,MM,dd,HH,mm,ss,SSS
but that is not essential of course.
« Last Edit: May 24, 2015, 09:12:55 am by xtradev »

xtradev

  • Newbie
  • *
  • Posts: 9
    • View Profile
Output message is unreadble
« Reply #1 on: May 24, 2015, 09:12:07 am »
Could you please format the output message so that its parts are separated?
Currently it is being output as one continuous string:
Quote
Expression: datetime("2015_01_01 13:02:53","yyyy_MM_dd hh:mm:ss")CenterdatetimeUnparseable date: "2015_01_01 13:02:53"

todaydad

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: hh and HH in datetime format string
« Reply #2 on: May 25, 2015, 12:53:56 am »
Date/time format mask inherits from JAVA, It's not our invention.
The error message should be modified, It's no dispute.

xtradev

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: hh and HH in datetime format string
« Reply #3 on: May 25, 2015, 10:51:52 am »
Quote
Date/time format mask inherits from JAVA
I did not know that.
The main point of my first post is that Function Reference -> datetime() and milliseconds() pages should mention uppercase HH so that others won't struggle.

todaydad

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: hh and HH in datetime format string
« Reply #4 on: May 26, 2015, 01:13:39 am »
Sorry, I misunderstood your sentence.
You're right, Function Reference should make some changes on "hh"