Re: functions for date parsing.

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Jeff MacDonald <jeff(at)tsunamicreek(dot)com>
Cc: Postgres List <pgsql-general(at)postgresql(dot)org>
Subject: Re: functions for date parsing.
Date: 2002-06-24 20:02:24
Message-ID: 3D177AD0.694C63EE@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vince Vielhaber 2002-06-24 20:15:59 Re: website design
Previous Message Nigel J. Andrews 2002-06-24 19:55:06 Re: pg_restore: [archiver] input file does not appear to