?
/**
* Convert to UNIX timestamp
*/
function GetTime ($d) {
if (Is_numeric ($d))
return $d;
else {
if (! is_string ($d)) return 0;
if (Ereg (":", $d)) {
$buf = Split ("", $d);
$year = Split ("[-/]", $buf [0]);
$hour = Split (":", $buf [1]);
if (Eregi ("PM", $buf [2]))
$hour [0] = 12;
return mktime ($hour [0], $hour [1], $hour [2], $year [1], $year [2], $year [0]);
}else {
$year = Split ("[-/]", $d);
Return Mktime (0,0,0, $year [1], $year [2], $year [0]);
}
}
}
/**
*
* DATEADD (Interval,number,date)
* Returns the date when the specified time interval has been added.
* Inetrval A string expression representing the time interval to add, such as minute or day
* number is a numeric expression that represents the number of time intervals to add
* Date indicates
*
* Interval (time interval string expression) can be any of the following values:
* YYYY year
* Q Quarter Quarter
* M Month Month
* Y days of year
* D Day
* W weekday days in a week
* WW Week of Year Week
* H Hour hours
* N minute points
* s second seconds
* The functions of W, Y and D are exactly the same, that is, add a day to the current date, Q plus 3 months, WW plus 7 days.
*/
function DateAdd ($interval, $number, $date) {
$date = gettime ($date);
$date _time_array = getdate ($date);
$hours = $date _time_array["Hours"];
$minutes = $date _time_array["Minutes"];
$seconds = $date _time_array["seconds"];
$month = $date _time_array["Mon"];