How to cast utc date to gmt +8 in presto sql?

by scotty_walker , in category: Third Party Scripts , 4 months ago

How to cast utc date to gmt +8 in presto sql?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by herminia_bruen , 4 months ago

@scotty_walker 

In Presto SQL, you can cast a UTC date to GMT +8 by using the from_utc_timestamp() function. Here is an example of how you can do this:

1
2
SELECT from_utc_timestamp(your_utc_date_column, '+08:00') AS gmt_plus_8_date
FROM your_table_name;


In this query, replace your_utc_date_column with the column containing the UTC date you want to convert and your_table_name with the name of your table.


The '+08:00' argument passed to the from_utc_timestamp() function specifies the GMT +8 timezone offset. This function will convert the UTC date to the GMT +8 timezone.


This will return the UTC date converted to GMT +8 timezone in the result set.

Related Threads:

How to cast date as date string in presto?
How to convert timestamp to date in presto?
How to convert date to gmt format using oracle?
How to convert local date time into gmt using php?
How to convert new date() to utc date using moment.js?
How to cast varbinary to varchar in presto?