Firebase endAt() not working with date string?

前端 未结 1 1553
野性不改
野性不改 2020-12-07 04:48

Pretty basic question in here

My Stored Date String is like this in Firebase DB

23-Oct-2016 07:00:11 AM

Now i am firing this query

相关标签:
1条回答
  • Storing dates and times as readable strings like you seem to be doing is guaranteed to give you a hard time. Strings are lexicographically ordered, while you typically want to treat dates as chronologically ordered. The two orders don't always match up.

    The best way to store a date/time for querying is as a simple timestamp: the number of milliseconds since the UNIX epoch.

    If you insist on storing the dates and times as more readable string, your better of storing them in a format that is both readable and will sort the same in both lexicographical and chronological order, such as the ISO 8601 formats: 20161023T150422. This is the current time as I type this: October 23, 2016 3:04 PM UTC.

    0 讨论(0)
提交回复
热议问题