Date DataTypes - LiquidAnalytics/ld-api-examples GitHub Wiki

##Date and Time DataTypes

Liquid Decisions supports a number of date data types for representing dates and times, it is important to understand the differences between them so you can choose the proper data type for your use case.

###DATETIME Represents an exact date and time, to the millisecond, with a provided timezone. Follows the ISO 8601 standard exactly.

####Example Usage The time an order was submitted. With a DATETIME, you can tell the exact date, time, and timezone when a salesRep submitted an order.

####Example Data

  • 2015-05-25T13:01:30.234-03:00 //May 25th 2015, 1:01:30.234 PM UTC -3:00
  • 2005-10-15T19:00:00.000Z // October 15th, 2005, 7:00:00.000 PM UTC

####Technical Details

  • Java class - org.joda.time.DateTime
  • Postgres datatype - timestamp with timezone (and additional utility field for storing UTC offset)
  • Cassandra storage format - String in ISO 8601 Standard
  • SQLite datatype - TEXT

###LOCALDATE Represents a date, without time or timezone specified. Means the same thing across timezones. Follows yyyy-MM-dd format.

####Example Usage Product X goes on sale on May 25th, 2015. Product Y is no longer valid after December 31st, 2020. Something becomes useable or visible on the user's device on this date in user's time.

####Example Data

  • 2015-05-25 // May 25th, 2015
  • 2020-12-31 // December 31st, 2020

####Technical Details

  • Java class - org.joda.time.LocalDate
  • Postgres datatype - date
  • Cassandra storage format - String in yyyy-MM-dd format
  • SQLite datatype - TEXT

###LOCALDATETIME Represents a date and time, to the millisecond, without timezone information. Follows yyyy-MM-dd’T’HH:mm:ss.SSS format.

####Example Usage Product X goes on sales on July 11th, 2015 at 10 AM, worldwide. Something becomes visible on the user's device at this time in the user's timezone.

####Example Data

  • 2015-07-11T10:00:00.000 // July 11th, 2015, 10:00:00 AM

####Technical Details

  • Java class - org.joda.time.LocalDateTime
  • Postgres datatype - timestamp without timezones
  • Cassandra storage format - String in yyyy-MM-dd’T’HH:mm:ss.SSS format
  • SQLite datatype - TEXT

###LOCALTIME Represents a time of day without date or timezone information. Follows HH:mm:ss.SSS format.

####Example Usage Business opens at 9 AM and closes at 5 PM. Something is visible on the user's device between these times, in the user's timezone.

####Example Data

  • 09:00:00.000 // 9 AM
  • 17:00:00.000 // 5 PM

####Technical Details

  • Java class - org.joda.time.LocalTime
  • Postgres datatype - time without timezone
  • Cassandra storage format - String in HH:mm:ss.SSS format
  • SQLite datatype - TEXT