pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
problem with date and to_char
4+ messages / 3 participants
[nested] [flat]

* problem with date and to_char
@ 2002-01-09 16:17  postgresql <pgsql@symcom.com>
  0 siblings, 1 reply; 4+ messages in thread

From: postgresql @ 2002-01-09 16:17 UTC (permalink / raw)
  To: pgsql-sql

I am a little stumped.
postgresql 7.1.3
suse linux 7

I have a database with

CREATE TABLE "fc_communication" (
	"acode" character varying(12),
	"conversation" text,
	"contactdate" date

CREATE TABLE "comm_date" (
	"lastcontact" timestamp with time zone DEFAULT 'now' NOT NULL,
	Constraint "comm_date_pkey" Primary Key ("lastcontact")

When I update fc_communication I also (without a trigger) update 
comm_date with a sep  

update comm_date set lastcontact = 'now';

it works beautifully if I do a psql
'select * from comm_date;'

2002-01-08 16:16:03

I always get the last moment that someone updated the communications file

however what I want to do is:
SELECT to_char(lastcontact, 'Month DD, YYYY   HH:MM') from comm_date;


January   08, 2002   04:01

why is this 04:01?

Every time I do this I get the very first date (that no longer exists). 
Why do I get different results. I expect 'select *' is the base and 
everything else is a varient.

Ted
tedpet@symcom.com





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: problem with date and to_char
@ 2002-01-10 00:19  Josh Berkus <josh@agliodbs.com>
  parent: postgresql <pgsql@symcom.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Berkus @ 2002-01-10 00:19 UTC (permalink / raw)
  To: postgresql <pgsql@symcom.com>; pgsql-sql

Ted,

> January   08, 2002   04:01
> 
> why is this 04:01?
> 
> Every time I do this I get the very first date (that no longer
> exists). 
> Why do I get different results. I expect 'select *' is the base and 
> everything else is a varient.

You're going to have to be clearer about the source of your confusion.
I've read your e-mail twice, and I just can't see what the problem is.
The results that you get are exactly according to the documentation.

-Josh


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: problem with date and to_char
@ 2002-01-10 00:49  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2002-01-10 00:49 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: postgresql <pgsql@symcom.com>; pgsql-sql

"Josh Berkus" <josh@agliodbs.com> writes:
> The results that you get are exactly according to the documentation.

A more useful answer might be to suggest that he wants HH24:MI
rather than HH:MM.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: problem with date and to_char
@ 2002-01-10 01:13  Josh Berkus <josh@agliodbs.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Josh Berkus @ 2002-01-10 01:13 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Josh Berkus <josh@agliodbs.com>; +Cc: postgresql <pgsql@symcom.com>; pgsql-sql

Tom,

> > The results that you get are exactly according to the
> documentation.
> 
> A more useful answer might be to suggest that he wants HH24:MI
> rather than HH:MM.

Oh!  That's the issue?  I really couldn't figure it out.

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-01-10 01:13 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-01-09 16:17 problem with date and to_char postgresql <pgsql@symcom.com>
2002-01-10 00:19 ` Josh Berkus <josh@agliodbs.com>
2002-01-10 00:49   ` Tom Lane <tgl@sss.pgh.pa.us>
2002-01-10 01:13     ` Josh Berkus <josh@agliodbs.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox