tags:

views:

38

answers:

2

What is an alternative in SQLite as STR_TO_DATE() funciton in MySQL?

A: 

Use strftime. Example:

strftime('%Y-%m-%d', 'now')

You could just use date if the date you are providing fits any of the following:

  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. DDDDDDDDDD

SQLite Date & Time Functions

OMG Ponies