Unix Technical Forum

Arrrr... date formatting.

This is a discussion on Arrrr... date formatting. within the Pgsql General forums, part of the PostgreSQL category; --> Shiver me timbers, whats up with to_char()?! Avast! Is there no way to get a month without it being ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 06:00 AM
Alex Turner
 
Posts: n/a
Default Arrrr... date formatting.

Shiver me timbers, whats up with to_char()?!

Avast! Is there no way to get a month without it being padded to nine
characters? It makes using a database to actualy format a date for output
kinda impossible?

I'll have to walk the plank if I can't get an answer, the crew will mutiny
and leave me on an island with a one-shot pistol and the sight of me sails
dissapearing over the horizon!

Alex Turner
NetEconomist
P.S. For those who didn't know - it's national talk like a pirate day.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 06:00 AM
Dianne Yumul
 
Posts: n/a
Default Re: Arrrr... date formatting.

May be you want the FM prefix, i.e. to_char(current_timestamp,
'FMMonth'). See the docs for more info:

http://www.postgresql.org/docs/8.0/i...ive/functions-
formatting.html#FUNCTIONS-FORMATTING-EXAMPLES-TABLE

On Sep 19, 2005, at 8:20 AM, Alex Turner wrote:

> Shiver me timbers, whats up with to_char()?!
>
> Avast!* Is there no way to get a month without it being padded to
> nine characters?* It makes using a database to actualy format a date
> for output kinda impossible?
>
> I'll have to walk the plank if I can't get an answer, the crew will
> mutiny and leave me on an island with a one-shot pistol and the sight
> of me sails dissapearing over the horizon!
>
> Alex Turner
> NetEconomist
> P.S. For those who didn't know - it's national talk like a pirate day.



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 06:00 AM
Lugovoi Nikolai
 
Posts: n/a
Default Re: Arrrr... date formatting.

Alex Turner wrote:
> Shiver me timbers, whats up with to_char()?!
>
> Avast! Is there no way to get a month without it being padded to nine
> characters? It makes using a database to actualy format a date for
> output kinda impossible?
>
> I'll have to walk the plank if I can't get an answer, the crew will
> mutiny and leave me on an island with a one-shot pistol and the sight of
> me sails dissapearing over the horizon!
>
> Alex Turner
> NetEconomist
> P.S. For those who didn't know - it's national talk like a pirate day.

select length(to_char('2005-Jun-10'::timestamp without time zone,
'FMMonth')); -> 4

Manual:
9.8. Data Type Formatting Functions
Table 9-22. Template Pattern Modifiers for Date/Time Formatting
Modifier Description Example
FM prefix fill mode (suppress padding blanks and zeroes) FMMonth


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 06:00 AM
Alex Turner
 
Posts: n/a
Default Re: Arrrr... date formatting.

50 pieces of eight to that man there!!

You are exactly right, the FM prefix is exactly what I'm seeking! I missed
that table right below the main formaing table that describes the prefixes.

May you find much buried treasure,

Alex Turner
NetEconomist

On 9/19/05, Dianne Yumul <dianne@wellsgaming.com> wrote:
>
> May be you want the FM prefix, i.e. to_char(current_timestamp,
> 'FMMonth'). See the docs for more info:
>
> http://www.postgresql.org/docs/8.0/i...ive/functions-
> formatting.html#FUNCTIONS-FORMATTING-EXAMPLES-TABLE
>
> On Sep 19, 2005, at 8:20 AM, Alex Turner wrote:
>
> > Shiver me timbers, whats up with to_char()?!
> >
> > Avast! Is there no way to get a month without it being padded to
> > nine characters? It makes using a database to actualy format a date
> > for output kinda impossible?
> >
> > I'll have to walk the plank if I can't get an answer, the crew will
> > mutiny and leave me on an island with a one-shot pistol and the sight
> > of me sails dissapearing over the horizon!
> >
> > Alex Turner
> > NetEconomist
> > P.S. For those who didn't know - it's national talk like a pirate day.

>
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-09-2008, 06:00 AM
Alex Turner
 
Posts: n/a
Default Re: Arrrr... date formatting.

Add to that they just re-released Sid Meier's Pirates, and I'm a hopeless
case mateys.

Alex

On 9/19/05, IanL PostgreSQL Lists <ian@dinwoodie.freeuk.com> wrote:
>
> Alex Turner wrote:
>
> > May you find much buried treasure,

>
> Somebody PLEASE burn his Privates of the Caribbean DVD!
>
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:30 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com