How to change the date format

When I execute the select CURRENT_TIMESTAMP() ; I am getting “2020-04-08 20:17:21” format. How to change this format and which variable need to be modified. Please guide me. What are the values we can keep for ‘time_zone’ variable.

Hi @rjsv!

You should check our date & time functions docs.
Specially the DATE_FORMAT function which enables converting datetimes to strings given a specified format.

Sample:

memsql> select date_format(now(), '%M %D, %Y');
+---------------------------------+
| date_format(now(), '%M %D, %Y') |
+---------------------------------+
| March 3rd, 2015                 |

I am asking the relevant environment variable.

Hello @rjsv!

Here is a list of possible values for the timezone var:

  1. SYSTEM
  2. offsets like +8:00
  3. TZ database names like Africa/Abidjan, Brazil/East, etc…
    You can set the variable setting the default_time_zone in the .cnf file.