|
|
|
<?
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
}
?>
source : http://www.xs.mw/robin/php.html |
|
| Record Set Paging with PHP (RSP) Categories : PHP, MySQL, Navigation, Databases, HTML and PHP | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | Database resultset navigation Categories : PHP, HTML and PHP, Databases, MySQL, Navigation | | | Function to do live population of HTML's <Select> tag from a Table Categories : PHP, MySQL, HTML and PHP, Databases | | | This program will take data from a user via a web based form, validate it, show it
to the user for re-validation, and finally insert it into the database. Plenty of
sanity checking on the fields in the form.
Categories : MySQL, HTML and PHP, PHP, Complete Programs, Databases | | | formating MySQL Timestamp to get a propper Output.
related : Timestamp, ereg_replace, mysql, substr Categories : MySQL, PHP, Date Time, Databases | | | CALENDAR - easy calendar-navigation with PHP Categories : PHP, Date Time, HTML and PHP, Calendar | | | Count how many weeks in the month have a specified day, such as Mon, Tue, etc. Var avail - number of days - first day name of the month, occurrences of Sun, occurrences of Mon, etc. Allows you to calculate number of working hours exclude Holidays. Categories : Calendar, Date Time, PHP, Databases, MySQL | | | html split bar used to split in multiple pages a database result Categories : HTML and PHP, Databases, MySQL, PHP | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager Categories : MySQL, PHP, MySQL, Complete Programs, Databases | | | How can i Preload a 'SELECT MULTIPLE'? Categories : HTML and PHP, PHP, MySQL, Databases | | | Local-to-user date and time display regardless of time zone or where the website's server is located Categories : PHP, Date Time, HTML and PHP, Java Script | | | Simple PHP control CSS Calendar Categories : PHP, HTML and PHP, Calendar, Date Time, CSS | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | |
|
|