By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

Timestamps in Views

P: n/a
Hi,
I use a data formatting in views (to_char(last_update, 'YYYY-MM-DD
HH:MM:SS') as last_update and noticed that the last update returned is
the creation date of the view or not the actual value of the
last_update.(last _update is a timestamp).

What do I need to do to display the actuall value?

Thanks
Alex


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thursday 23 October 2003 09:07, Alex wrote:
Hi,
I use a data formatting in views (to_char(last_update, 'YYYY-MM-DD
HH:MM:SS') as last_update and noticed that the last update returned is
the creation date of the view or not the actual value of the
last_update.(last _update is a timestamp).


It doesn't sound likely - could you provide the view definition and a couple
of lines of output?

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #2

P: n/a
Richard,
have a look I also don't quite understand why it is happening.
The dates returned are actually not the creation date of the view but just a different date.
Thanks
Alex

# drop view view_joblog;
DROP VIEW
# CREATE VIEW view_joblog AS
# SELECT log_id AS lid,job_id AS jid, job_type AS jtype, to_char(job_start, 'YYYY-MM-DD HH:MM:SS') AS job_start,to_char(job_end, 'YYYY-MM-DD HH:MM:SS') AS job_end,job_status AS jstat,
# log_file AS log_file, pid FROM job_log ORDER BY log_id;
CREATE VIEW
# select * from view_joblog where lid=530;
-[ RECORD 1 ]---------------------------------
lid | 530
jid | 198
jtype | 21
job_start | 2003-10-07 10:10:28
job_end | 2003-10-07 10:10:05
jstat | 4
log_file | clientfiles-21-20031007-103928.xml
pid | 30724

# select log_id,job_id,job_type,job_start,job_end,job_statu s,log_file,pid FROM job_log where log_id=530;
-[ RECORD 1 ]----------------------------------
log_id | 530
job_id | 198
job_type | 21
job_start | 2003-10-07 10:39:28.172914
job_end | 2003-10-07 10:42:05.140341
job_status | 4
log_file | clientfiles-21-20031007-103928.xml
pid | 30724

Richard Huxton wrote:
On Thursday 23 October 2003 09:07, Alex wrote:

Hi,
I use a data formatting in views (to_char(last_update, 'YYYY-MM-DD
HH:MM:SS') as last_update and noticed that the last update returned is
the creation date of the view or not the actual value of the
last_update.(last _update is a timestamp).


It doesn't sound likely - could you provide the view definition and a couple
of lines of output?


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #3

P: n/a
On Friday 24 October 2003 02:13, Alex wrote:
Richard,
have a look I also don't quite understand why it is happening.
The dates returned are actually not the creation date of the view but just
a different date. Thanks # SELECT log_id AS lid,job_id AS jid, job_type AS jtype,
to_char(job_start, 'YYYY-MM-DD HH:MM:SS') AS job_start,to_char(job_end, job_start | 2003-10-07 10:10:28


Ah! got it - you're using MM for month and minute. It'll be "m" or "i" or
something.

I've done the same, and looked at the code 100 times without noticing it.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.