[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] PERL + SQL Dates
- Subject: [ale] PERL + SQL Dates
- From: phasefx at magusaptus.com (Jason Etheridge)
- Date: Tue Apr 27 09:17:55 2004
- In-reply-to: <1083070211.17414.55.camel@devel>
- References: <1083070211.17414.55.camel@devel>
> I'm storing my dates in MySQL as "YYYY-MM-DD HH:MM:SS" I need to be
> able in perl to convert that time to epoch and also convert an epoch
> into that format. Anyone have any secrets for me?
I thought I had some answers, but there's a slight discrepency:
perl -e 'use POSIX; print mktime(0,0,12,14,4-1,2004-1900,0,0,0), "\n";'
1081962000
mysql> SELECT unix_timestamp('2004-4-14 12:00:00');
+--------------------------------------+
| unix_timestamp('2004-4-14 12:00:00') |
+--------------------------------------+
| 1081958400 |
+--------------------------------------+
YMMV :D
-- Jason