Treatment time

xiaoxiao2021-03-05  24

Timer.class.php This function solutions the return time display format problem.

Including all formats of the Date () function, the default $ TYPE is the most common type / / In addition to $ Year, $ MONTH, $ TY, $ HOUR, $ MINUTE, $ SECOND; Add $ Week, $ Zone The first few days in the year), $ Nummonth (number of days in the current month) // wherein the default is the most common format // characteristics, the most used in time processing is MKTIME, where MKTIME can be entered according to the habits (Year, Month, Day) show / mktimey (); mktimew (); mktimem (); mktimed (); easy to set up a time to be separated from Y years, N-month, convenient in mysql search, // subtime (); The function can be easily obtained for two times, the number of days, the week // ################################################################################################################################################################################################################################################################################### ####################### c $ month; // month var $ month; // month var $ Day; // day var $ hour; // time var $ minute; // divided Var $ SECOND; // Second Var $ week; // week var $ zone; // The first day of the year Var $ Nummonth; // The number of days in the current month var $ mktime; // mktime function year ($ time = ", $ type = 0) {// Return year // $ TYPE = 0 indicate return four-digit year // $ TYPE = 1 Represents the year IF ($ TIME == ") $ TIME = Time (); if ($ TY == 0) $ this-> year = Date (" y ", $ time); if ($ TYPE == 1) $ this-> Year = Date ("y", $ time); return $ this-> year;} function month ($ time = ", $ type = 0) {// Return Month // $ TYPE = 0 indicates that return 1 ~ 12 // $ TYPE = 1 indicates that return 01 ~ 12 // $ TYPE = 2 indicates return Jan .. Three English letters // $ TYPE = 3 Express Back English full name IF ( $ TIME == "" "$ TIME = Time (); if ($ TYPE == 0) $ this-> Month = Date (" n ", $ time); if ($ type == 1) $ THIS-> Month = DATE ("M", $ TIME); if ($ TYPE == 2) $ this-> Month = Date ("M", $ TIME); if ($ TYPE == 3) $ this-> Month = Date ("

F ", $ time); return $ this-> month;} Function Day ($ TIME =" ", $ TYPE = 0) {// Return Day // $ TYPE = 0 Return 1 ~ 31 / / $ TYPE = 1 Return 01 ~ 31 IF ($ TIME == ") $ TIME = Time (); if ($ TYPE == 0) $ this-> day = date (" j ", $ time); if ($ type == 1) $ this-> day = Date ("D", $ time); return $ this-> day;} Function Hour ($ TIME = ", $ TYPE = 0) {// Return Time // $ TYPE = 0 Return 1 ~ 24 // $ TYPE = 1 Return 1 ~ 12 // $ TYPE = 2 Return 01 ~ 24 // $ TYPE = 3 Return 01 ~ 12 IF ($ TIME == ") $ TIME = TIME () ; If ($ TYPE == 0) $ this-> hours = Date ("h", $ time); if ($ type == 1) $ this-> hours = Date ("h", $ time); if ($ TYPE == 2) $ this-> Hour = Date ("g", $ time); if ($ type == 3) $ this-> hours = date ("g", $ time); return $ THIS -> Hour;} Function Minute ($ TIME = ", $ type = 0) {// Return points IF ($ TIME ==") $ TIME = Time (); if ($ TYPE == 0) $ THIS -> Minute = DATE ("I", $ TIME); RETURN $ this-> minute;} Function Second ($ TIME = ", $ TYPE = 0) {// Return Second // $ TYPE = 0 Return 1 ~ 59 // $ TYPE = 1 Return word tail plus English order, two English alphabet IF ($ TIME == ") $ TIME = Time (); if ($ TYPE == 0) $ this-> second = Date (" s ", $ time); if ($ TYPE == 1 $ this-> Second = Date ("s", $ time); return $ this-> second;

} Function Week ($ TIME = ", $ TY = 0) {// Return Week // $ TYPE = 0 Return 0 ~ 6 // $ TYPE = 1 Return Three Letters Week // $ TYPE = 2 Return Week IF ($ TIME == ") $ TIME = TIME (); if ($ TY == 0) $ this-> week = Date (" w ", $ time); if ($ TYPE == 1 $ this-> week = Date ("D", $ TIME); if ($ TYPE == 2) $ this-> week = date ("l", $ time); return $ this-> week;} function ZONE ($ TIME = ") {// The first few days in the year; if ($ time ==") $ TIME = Time (); $ this-> zone = Date ("z", $ time) Return $ this-> zone;} Function Nummonth ($ TIME = ") {// Current Month Day IF ($ TIME ==") $ TIME = Time (); $ this-> Nummonth = Date (" T ", $ TIME); RETURN $ THIS-> Nummonth;} Function Time ($ TIME =") {// acquisition all the parameters about the current time.

IF ($ TIME == "") $ TIME = Time (); $ this-> Year ($ TIME); $ this-> Month ($ TIME); $ this-> day ($ time); $ this-> Hour ($ time); $ this-> minute ($ TIME); $ this-> Second ($ TIME); $ THIS-> Week ($ TIME); $ THIS-> ZONE ($ TIME); $ this-> Nummonth ($ TIME);} Function BetWeentime ($ atime = ", $ bTIME =" ") {// calculates two times separated days, month, etc. IF ($ atime ==") $ atime = TIME ); If ($ bTIME == ") $ bTIME = Time ();} Function Mktime ($ Year = 0, $ MONTH = 0, $ day = 0, $ hour = 0, $ minute = 0, $ second = 0) {// Year-month day-to-date second $ this-> mktime = mktime ($ HOUR, $ MINUTE, $ Second, $ MONTH, $ day, $ year); Return $ this-> mktime;} Function Mktimey ($ TIME = "", $ y = 1) {// get a certain time y years before, the default is 1 $ this-> time ($ TIME); $ this-> mktime = mktime (0,0,0 ,, .. -> Month, $ this-> day, ($ this-> year- $ y); return $ this-> mktime;} function mktimem ($ time = ", $ m = 1) {// get a certain one Time M month ago, default is 1 $ this-> Time ($ TIME); $ this-> mktime = mktime (0,0,0,0,0, $ this-> Month- $ m, $ this-> day, $ THIS -> Year); Return $ this-> mktime;} function mktim Ed ($ TIME = ", $ d = 1) {// get a time D days before, default is 1 day $ this-> time ($ TIME); $ this-> mktime = mktime (0,0 , $ This-> day- $ d, $ this-> year; return $ this-> mktime;} Function Mktimew ($ TIME = ", $ W = 1) {// Get a certain time W Week, the default is 1 week $ this-> Time ($ TIME); $ this-> mktime = mktime (0,0,0, $ this-> Month, $ this-> day- 7 * $ w, $ this-> year); return $ this-> mktime;} Function Subtime ($ atime = ", $ bTIME ="

转载请注明原文地址:https://www.9cbs.com/read-32296.html

New Post(0)