Re: Need some help with dates

From: "Miguel Carvalho" <miguel(at)ipatimup(dot)pt>
To: <stephane(at)smeso(dot)fr>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Need some help with dates
Date: 2002-04-17 14:53:53
Message-ID: 21044.195.23.103.182.1019055233.squirrel@www.ipatimup.pt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hi.
>
> First, let me apologize for my poor level in english, I hope you'll
> understand me.
>
> I'm new in PL/PgSQL, and I have a little problem.
>
> I have a temporary table (temp) with only varchar. I must do a request
> that fill another table (mclis) with temp's data. But on the new
> tables, I have a field in date format. When I make a
>
> update mclis
> set cli_date = temp.temp1
>
> he doesn't want because of the different formats ('column "cli_date" is
> of type 'date' but expression is of type 'character varying').
>
> In temp, my data are like 01/01/2001
>

Convert your date from varchar to date, using the to_date function.
ex:

to_date('05 Dec 2000', 'DD Mon YYYY')

Take a look at the formating functions available in Postgresql:
http://www.postgresql.org/idocs/index.php?functions-formatting.html

Regards
Miguel Carvalho

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-04-17 15:25:35 Re: How to reset sequences on pre-7.1
Previous Message Larry Rosenman 2002-04-17 14:41:29 Re: [SQL] 16 parameter limit