Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalence of MS SQL Server's getutcdate() in postgresql? [duplicate]

I migrate from SQL Server to PostgreSQL. How to translate the getutcdate function like:

Insert into mytable (mypk, toucheddate) values (99, getutcdate() )

(I'm not asking for an equivalent to MySQL, this is a different platform)

like image 855
ilsankergeeky Avatar asked May 05 '15 17:05

ilsankergeeky


1 Answers

There are at least two ways to get the current time in UTC:

select now() at time zone 'utc';

select current_timestamp at time zone 'utc';
like image 86
Sami Kuhmonen Avatar answered Oct 23 '22 18:10

Sami Kuhmonen