Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: Formatting MySQL's TIMESTAMP

by dempa (Friar)
on Mar 21, 2002 at 09:32 UTC ( [id://153280]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Formatting MySQL's TIMESTAMP
in thread Formatting MySQL's TIMESTAMP

Well, apart from the timezone that would in DATE_FORMAT syntax equal:

%W %d %M %Y @ %I:%i%p

If you're willing to be a bit database-specific, use UNIX_TIMESTAMP to get the timestamp in epoch-format and then use POSIX::strftime to format your date.
# epoch-date in $epoch use POSIX; my $formatted_date = POSIX::strftime("%A %d %B %Y @ %I:%M%p %Z",localtime($epoch));
If you want to be as non db-specific as possible, take the advice below and forget UNIX_TIMESTAMP. Just select the timestamp-column and use appropriate date-manipulation module to convert it to epoch-format.

Replies are listed 'Best First'.
Re: Re: Re: Re: Formatting MySQL's TIMESTAMP
by rendler (Pilgrim) on Mar 21, 2002 at 09:52 UTC
    Thanks that first option looks good enough for me. Guess I should have really looked at the manual first (lists all the codes).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://153280]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-25 02:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found