pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
to_date()
2+ messages / 2 participants
[nested] [flat]

* to_date()
@ 2002-06-03 00:53 Paul  <paul@operamail.com>
  2002-06-03 16:04 ` Re: to_date() Kaare Rasmussen <kar@kakidata.dk>
  0 siblings, 1 reply; 2+ messages in thread

From: Paul @ 2002-06-03 00:53 UTC (permalink / raw)
  To: pgsql-sql

Can someone explain to me why this happens?
======
select to_date('2002-04-29 07:33:55.000','FXYYYY-MM-DD HH24:MM:SS.MS') as rebill_date;
 rebill_date 
-------------
 2004-09-30
======

Ultimatly I'm doing a select into where the original field is of type "character varying".
Doing
======
select fieldname::date as rebill_date
======
generates a "ERROR:  Cannot cast type 'character varying' to 'date'" error, but doing
======
select fieldname::text::date as rebill_date
======
seemes I think I've achieved what I want, but would still be interested in learning about to_date().

Thanks,

Paul
-- 
_______________________________________________
Download the free Opera browser at http://www.opera.com/

Powered by Outblaze



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

* Re: to_date()
  2002-06-03 00:53 to_date() Paul  <paul@operamail.com>
@ 2002-06-03 16:04 ` Kaare Rasmussen <kar@kakidata.dk>
  0 siblings, 0 replies; 2+ messages in thread

From: Kaare Rasmussen @ 2002-06-03 16:04 UTC (permalink / raw)
  To: Paul <paul@operamail.com>; pgsql-sql

> Can someone explain to me why this happens?
> ======
> select to_date('2002-04-29 07:33:55.000','FXYYYY-MM-DD HH24:MM:SS.MS') as
> rebill_date; rebill_date
> -------------
>  2004-09-30

If you only want the date:
select to_date('2002-04-29 07:33:55.000','FXYYYY-MM-DD HH24:MI:SS.MS') as 
rebill_date;

If you want the whole thing:
select to_timestamp('2002-04-29 07:33:55.000','FXYYYY-MM-DD HH24:MI:SS.MS') 
as rebill_date;

MM is month
MI is minute

-- 
Kaare Rasmussen            --Linux, spil,--        Tlf:        3816 2582
Kaki Data                tshirts, merchandize      Fax:        3816 2501
Howitzvej 75               Åben 12.00-18.00        Web:      www.suse.dk
2000 Frederiksberg        Lørdag 11.00-17.00       Email: kar@kakidata.dk



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


end of thread, other threads:[~2002-06-03 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-06-03 00:53 to_date() Paul  <paul@operamail.com>
2002-06-03 16:04 ` Kaare Rasmussen <kar@kakidata.dk>

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