Formatting the date in Apache Hive

The “Date Format” function is used but not limited to the following situations.

  • If the current or default date format needs to be changed to meet the legal and cultural criteria for the date and time of recognition of the region.
  • If an output demands a formatted date.

Syntax: date_format(date/timestamp/string ts, string fmt)

SELECT date_format(‘2021-02-06’,”dd/MM/yyyy”);
Returns 06/02/2021

SELECT date_format(current_date, “dd-MM-yy hh:MM:ss.sss”);
Returns 06-02-21 12:02:00.000


Hope you find this article helpful.

Please click on follow button to updates on latest posts.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s