[SLUG] Perl + Mysql + Strftime

2001-01-30 Thread Dean Hamstead
Im trying to get a value from a timestamp field into a format that strftime can manipulate. UNIX_TIMESTAMP(field) doesnt seem to produce a value strftime can use. If you hadnt guessed im in (mod) perl Id prefer not to have to use mysqls time functions to extract the values needed. Strftime

Re: [SLUG] Perl + Mysql + Strftime

2001-01-30 Thread John Clarke
On Tue, Jan 30, 2001 at 08:49:34PM +1100, Dean Hamstead wrote: Im trying to get a value from a timestamp field into a format that strftime can manipulate. Here's an example from the perlfunc man page: use POSIX qw(strftime); $now_string = strftime "%a %b %e %H:%M:%S %Y",

Re: [SLUG] Perl + Mysql + Strftime

2001-01-30 Thread Dean Hamstead
Thats not the problem heres an example... #!/usr/bin/perl use POSIX; print strftime "%d","980596729"; 980596729 is the value give when i go select UNIX_TIMESTAMP(time) from database. i get this error Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1,

Re: [SLUG] Perl + Mysql + Strftime

2001-01-30 Thread John Clarke
On Wed, Jan 31, 2001 at 10:11:46AM +1100, Dean Hamstead wrote: Thats not the problem Sorry, my misunderstanding ... localtime() and gmtime() will convert a Unix timestamp to hours, minutes, seconds etc, which is exactly what strftime needs: [johnc@dropbear ~]$ perl -e 'use POSIX; print

Re: [SLUG] Perl + Mysql + Strftime

2001-01-30 Thread Dean Hamstead
Thanks John! Dean John Clarke wrote: On Wed, Jan 31, 2001 at 10:11:46AM +1100, Dean Hamstead wrote: Thats not the problem Sorry, my misunderstanding ... localtime() and gmtime() will convert a Unix timestamp to hours, minutes, seconds etc, which is exactly what strftime needs: