SpellsBook

 +PHP
+ Adobe Flash 2 0 (0)
+ Arrays (4)
+ COM for Windows (2)
+ Image (2)
+ LDAP (3)
+ MySQL (11)
+ Regular Expressions (2)
+ String Manipulation (12)
+ Time and Date (6)
+ Date Format
+ Hours to Minutes
+ Minutes to Hours
+ Past Present Future
+ String to Date
+ Today
 +Snippet Options
+   Printer Friendly
 +Library Options
+   View Other Library
Adobe_Flash_3_0
C_Plus_Plus
Debian_Install
Del_me_Soon
HTML_and_CSS
JavaScript
Linux_Commands
PHP
 +General Options
+   Library Home
+   PHP-CSL Credits
+   PHP-CSL License
+   Resource Links
+   Log in
Syntax for: Time and Date / String to Date

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:

<?php

echo strtotime ("now"), "n";
echo 
strtotime ("10 September 2000"), "n";
echo 
strtotime (" 1 day"), "n";
echo 
strtotime (" 1 week"), "n";
echo 
strtotime (" 1 week 2 days 4 hours 2 seconds"), "n";
echo 
strtotime ("next Thursday"), "n";
echo 
strtotime ("last Monday"), "n";
?>

Checking for failure
<?php
$str 
'Not Good';
if ((
$timestamp strtotime($str)) === -1) {
    echo 
"The string ($str) is bogus";
} else {
    echo 
"$str == "date('l dS of F Y h:i:s A',$timestamp);
}
?>
 
Description for: Time and Date / String to Date
  Parse about any English textual datetime description into a UNIX timestamp


 
Powered by: PHP-CSL V0.9