Re: functions for date parsing. - Mailing list pgsql-general

From Thomas Lockhart
Subject Re: functions for date parsing.
Date
Msg-id 3D177AD0.694C63EE@fourpalms.org
Whole thread Raw
In response to functions for date parsing.  ("Jeff MacDonald" <jeff@tsunamicreek.com>)
List pgsql-general
> sample=> select age(now()::date,'1990-01-01'::date);
> -------------------------------
>  12 years 5 mons 22 days 23:00
> within postgres, how can i parse this to somethig like
> 12 years 5 months

lockhart=# select date_trunc('month',
age(now()::date,'1990-01-01'::date));
-----------------
 12 years 5 mons

to_char() will probably do what you need also.

                   - Thomas



pgsql-general by date:

Previous
From: Varun Kacholia
Date:
Subject: More indexes...more better?
Next
From: "Ian Harding"
Date:
Subject: Re: PostgreSQL now part of the Lindows "Click-n-Run"