Skip site navigation (1) Skip section navigation (2)

Re: Date Formatting

From: Doug Silver <dsilver(at)urchin(dot)com>
To: Tom Ansley <tansley(at)law(dot)du(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Date Formatting
Date: 2002-05-03 21:05:46
Message-ID: Pine.LNX.4.21.0205031353290.4244-100000@danzig.sd.quantified.net (view raw or flat)
Thread:
Lists: pgsql-novice
Hi Tom -

select cast (now() as date) as date;
    date    
------------
 2002-05-03

Depending on your application (e.g. perl/php script), that output is easy
enough change it around to what you want or you could certainly write a
function to do it -- something I have yet to do!  I think such a function
would be fairly easy to do since you're just rearranging the
output, but doesn't everything look easy at the outset?  You didn't
mention the context of what you need this for, so there are lots of ways
to do this.

-doug

On Fri, 3 May 2002, Tom Ansley wrote:

> I am writing timestamps to file and the formatting is currently 2002-06-06 
> 00:00:00.0.  Is there a function to only write the date and also to format it 
> something like MM/dd/yyyy   ?
> 
> Thanks
> 
> Tom 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Silver
Network Manager
Urchin Corporation	http://www.urchin.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


In response to

Responses

pgsql-novice by date

Next:From: Kristian Skrede GleditschDate: 2002-05-03 22:54:04
Subject:
Previous:From: Tom AnsleyDate: 2002-05-03 19:31:43
Subject: Date Formatting

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group