By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,011 Members | 2,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,011 IT Pros & Developers. It's quick & easy.

Convert to Unix Timestamp

P: n/a

How can I convert a date into the Unix timestamp?

I don't really mind what format the date is in, something like MMDDYY
would be fine, can someone show me what code I would need to do that


There's plenty of functions out there to convert FROM a Unix timestamp
but I can't find any for the other way round.
Feb 7 '08 #1
Share this Question
Share on Google+
4 Replies

P: n/a
It's OK I worked it out using the mktime function, sorry to bother

Here's the code in case anyone else is as dumb as me ;-)

$aDate = explode("/",$date);

$unixtime = mktime(0, 0, 0, $aDate[1], $aDate[0], $aDate[2]);

(This will take the $date in format DD/MM/YY)
Feb 7 '08 #2

P: n/a

Feb 7 '08 #3

P: n/a
jpedrobarbosa wrote:
Though that behaves unreliably with dd/mm/(yy)yy dates.
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 9 days, 15:56.]

The Great IE8 Meta Tag Debacle
Feb 8 '08 #4

P: n/a
didnt know that: thanks ;-)
Feb 8 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.