SQLite date/time

SQLite Date and Time

Five date and time functions are available, as follows:
  1. date( timestring, modifier, modifier, ...)
  2. time( timestring, modifier, modifier, ...)
  3. datetime( timestring, modifier, modifier, ...)
  4. julianday( timestring, modifier, modifier, ...)
  5. strftime( format, timestring, modifier, modifier, ...) 
A time string can be in any of the following formats:
  1. YYYY-MM-DD
  2. YYYY-MM-DD HH:MM
  3. YYYY-MM-DD HH:MM:SS
  4. YYYY-MM-DD HH:MM:SS.SSS
  5. YYYY-MM-DDTHH:MM
  6. YYYY-MM-DDTHH:MM:SS
  7. YYYY-MM-DDTHH:MM:SS.SSS
  8. HH:MM
  9. HH:MM:SS
  10. HH:MM:SS.SSS
  11. now
  12. DDDD.DDDD 
The time string can be followed by zero or more modifiers that alter the date or alter the interpretation of the date. The available modifiers are as follows.
  1. NNN days
  2. NNN hours
  3. NNN minutes
  4. NNN.NNNN seconds
  5. NNN months 
  6. NNN years 
  7. start of month
  8. start of year
  9. start of week (withdrawn -- will not be implemented)
  10. start of day
  11. weekday N 
  12. unixepoch
  13. localtime
  14. utc 
其中Time String 主要以"-"作為年月日的分隔符號,若是不同的分隔符號用
core function::replace("yyyy/mm/dd", "/", "-")去修改

Some example

SELECT * FROM totp WHERE wk = '1982-05-20'  /* 指定某一天 */

SELECT * FROM totp WHERE wk BETWEEN '1980-05-20' AND '1980-05-26'  /* range */

沒有留言:

張貼留言