SQLite strftime() Function

Did you know that strftime() is an SQLite function than allows the programmer to return a formatted date. 

It takes two arguments: 

strftime(format, column)

  • To get an hour: strftime('%H', column_name)

  • To get the year: strftime('%Y', column_name)

  • To get the month: strftime('%m', column_name)

  • To get the day: strftime('%d', column_name)

  • To get the minute: strftime('%m', column_name)

  • To get the second: strftime('%S', column_name)

The above is true as long as the time format is YYYY-MM-DD HH:MM:SS

More on this function can be read from the SQL documentation here.

No comments:

Post a Comment

Web Development: Organizing Files and Folders

When you begin to build your website, it's a very clever idea to organize  your files and folders efficiently. You should have: A ...