/ Published in: PHP
Dates and Time are always important to understand in any language. PHP has some rockin' functions but here are a few that I use the most.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function strip_zeros_from_date( $marked_string = "" ){ //Remove any Zeros in the date //Remove the Asterik regardless of no Zeros return $cleaned_string; } //Number of seconds since January 1, 1970 echo "<br /><br />"; //Make a timestamp using mktime( $hr, $min, $sec, $mo, $day, $yr ) echo "<br /><br />"; //Convert this date to a string echo "<br /><br />"; //Convert Last Monday to a String echo "<br /><br />"; //Convert 1 day from today to a String echo "<br /><br />"; //Check if this date is valid (February 31st) echo "<br /><br />"; //Format a Unix Timestamp into something human readable (http://php.net/manual/en/function.strftime.php) //The asterik is neat little hack that will help us build a helper function echo "<br /><br />"; //Format your date in PHP for MySQL echo $mysql_datetime;