Php > Date Time
Convert date's in YYYY-MM-DD (i.e. mysql format) into PHP3 timestamps
Convert date's in YYYY-MM-DD (i.e. mysql format) into PHP3 timestamps function GetTimeStamp($MySqlDate) { /* Take a date in yyyy-mm-dd format and return it to the user in a PHP timestamp Robin 06/10/1999 */ $date_array = explode("-",$MySqlDate); // split the array $var_year = $date_array[0]; $var_month = $date_array[1]; $var_day = $date_array[2]; $var_timestamp = mktime(0,0,0,$var_month,$var_day,$var_year); return($var_timestamp); // return it to the user } function GetDayDiff($ts_1, $ts_2) { /* This will return the difference in days between two PHP timestamps Robin 06/10/1999 */ // calculate which is the larger so we never get negative answers if ($ts_1 > $ts_2) { // $ts_1 is larger $var_days = ($ts_1 - $ts_2) / 86400; /// 60 / 60 / 24; } elseif ($ts_1 < $ts_2) { // $ts_1 is smaller $var_days = ($ts_2 - $ts_1) / 86400; /// 60 / 60 / 24; } else { // they must be equal $var_days = 0; } return($var_days); //return the value } ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage