How the DateTime() Function Works in SQLite

The SQLite datetime() function enables you to return a date and time value based on a time string and any modifiers.

It returns the date in this format: YYYY-MM-DD HH:MM:SS

To use this function, you need to provide a time string, plus any (optional) modifiers. A modifier allows you to change the date, such as add a number of days, set it to local time, etc

Continue reading

Get the Month Name from a Date in PostgreSQL

If you’re familiar with PostgreSQL, you might know that you can use the EXTRACT() and the DATE_PART() functions to extract the month from a date. But those functions only allow you to extract the month number.

What if you need the month name?

You can get the month name from a date by using the TO_CHAR() function. This function returns a string based on the timestamp and the template pattern you provide as arguments.

Continue reading