Convert Date/Time to Unix Timestamp using PHP

Very helpful function to convert date/time string to Unix timestamp. I needed this function to update the timestamp field of some comments in my Drupal after migrating them from my blog on blogspot.

PHP Code:
{{{
<?php
echo strtotime('2005-08-25 12:04:53')."\n";
?>
}}}
Display:
{{{ 1124960693 }}}

Thanks to AlienBrain from EgLUG for advice.
Read more: http://www.php.net/strtotime

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

microseconds

any ideas to get also the microseconds? or it's not possible?

Before and after PHP5

According to PHP documentation: before PHP 5.0, microseconds weren't allowed in the time, since PHP 5.0 they are allowed but ignored!!!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <ins> <del> <blockquote> <span> <center>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.
  • You may write mixed Arabic and English freely, line direction will be computed automaticaly

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.
Syndicate content