<?
/**
* 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 with the specified interval added.
* Inetrval indicates the time interval string expression to be added, for example, minute or day
* Number is a numeric expression that represents the number of time intervals to be added.
* Date indicates the Date.
*
* Interval (Time Interval string expression) can be any of the following values:
* Yyyy year
* Q Quarter
* M Month
* Y Day of year
* D Day
* W Weekday
* Ww Week of year Week
* H Hour
* N Minute points
* S Second seconds
* W, y, and d play the same role, that is, add one day to the current date, add three months to q, and add seven days to ww.
*/
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"];