DBA Hub

📋Steps in this guide1/1

Find current data/time on postgres db

-- Below commands can be used to find postgres db date/timestamp

postgresql configurationintermediate
by PostgreSQL
15 views
1

Find current data/time on postgres db

-- Below commands can be used to find postgres db date/timestamp

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
postgres=#
SELECT CURRENT_TIMESTAMP;
current_timestamp
----------------------------------
2020-07-06 17:45:24.929293+05:30
(1 row)
postgres=#
select current_date;
current_date
--------------
2020-07-06
(1 row)
postgres=#
select statement_timestamp() ;
statement_timestamp
----------------------------------
2020-07-06 17:46:16.825492+05:30
(1 row)
postgres=#
select timeofday() ;
timeofday
-------------------------------------
Mon Jul 06 17:46:23.861551 2020 IST
(1 row)
postgres=#
select localtime(0);
localtime
-----------
17:52:38
(1 row)
postgres=#
select localtimestamp(0);
localtimestamp
---------------------
2020-07-06 17:52:48
(1 row)

Comments (0)

Please to add comments

No comments yet. Be the first to comment!