Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

Special Date/Time Formatting

Jim_KnicelyJim_Knicely Administrator
edited October 2018 in Tips from the Team

Vertica supports several special date/time values for our convenience. All of these values need to be written in single quotes when used as constants in SQL statements.

My favorite is ALLBALLS which is named so because the time digits look like balls (I had to Google that).


dbadmin=> SELECT timestamp 'today'     midnight_today,
dbadmin->        timestamp 'yesterday' midnight_yesterday,
dbadmin->        timestamp 'tomorrow'  midnight_tomorrow,
dbadmin->        time      'allballs'  midnight_utc_time;
   midnight_today    | midnight_yesterday  |  midnight_tomorrow  | midnight_utc_time
 2018-10-15 00:00:00 | 2018-10-14 00:00:00 | 2018-10-16 00:00:00 | 00:00:00
(1 row)

Helpful links:

Sign In or Register to comment.

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.