question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Re-design the date time format

See original GitHub issue

Currently the date time format is of the format:

  • <size>:<timeUnit>:<timeFormat>(:<pattern>( tz(<timezone>))

E.g.

  • 1:SECONDS:EPOCH
  • 1:DAYS:SIMPLE_DATE_FORMAT:yyyy-MM-dd tz(America/Chicago)
  • 1:MILLISECONDS:TIMESTAMP

The problem of this format is that for certain time format, the size and time unit is implicit, and will cause confusion.

The proposal is to change the time format to:

  • EPOCH|<timeUnit>(|<size>)
    • EPOCH|SECONDS
    • EPOCH|MINUTES|5
  • SDF|<timeFormat>(|<timezone>)
    • SDF|yyyy-MM-dd
    • SDF|yyyy-MM-dd'T'HH:mm:ss'Z'|America/Chicago
  • TIMESTAMP

We want to change the delimiter so that it won’t be mixed with the character in the time format

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Jackie-Jiangcommented, May 4, 2022

@KKcorps Agree that keeping it as JSON would be easier to use. We still need a single string representation though which can be used as the argument of the DATE_TIME_CONVERT function. The changes proposed here is for the existing DateTimeFieldSpec and DATE_TIME_CONVERT function, and we should do it in a backward compatible way. The long term solution should be to introduce the DATE_TIME data type, which can take extra properties (e.g. pattern, timeZone).

2reactions
KKcorpscommented, May 5, 2022

I feel both of these formats cause a lot of confusion for new users. What each value represents is not implicit and requires going through the doc to change every time. I propose a better way to handle this is to just keep this whole field as JSON. e.g.

{
      "granularity":1,
      "granularityTimeUnit":"DAYS",
      "inputTimeFormat":"SIMPLE_DATE_FORMAT",
      "pattern":"yyyy-MM-dd",
      "timeZone":"PST"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing guidelines - Date and time - Content
A note for Content Designers · Abbreviating days and months · The date format in American English · Numerical dates · Grammar and...
Read more >
Data formats - Material Design
Time and date ranges ; Year. Date ranges are formatted based on whether the range covers the same year or the current year:...
Read more >
Date Format - Dribbble
Date Format. Inspirational designs, illustrations, and graphic elements from the world's best designers. Want more inspiration? Browse our search results.
Read more >
Customize the taskbar date and time formats in Windows 10
Go to the Date tab. There you will see the notation of the short and long date formats and a preview of how...
Read more >
Datetime Format Converter - Internet Marketing Ninjas
Use the Datetime Format Converter to format data in text or unix timestamp. Datetime data can then be applied in the desired format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found