Php is compatible with the Unix timestamp conversion function after January 1, 2038, 2038 unix. Php is compatible with the Unix timestamp conversion function after January 1, 2038. the 2038unix usage is exactly the same as that of the old function. copy the code as follows: functionfun_strtotime ($ var10, $ var20) {if (! $ Var2 php is compatible with Unix timestamp conversion functions after January 2038, 2038 unix
The usage is exactly the same as that of the old function.
The code is as follows:
Function fun_strtotime ($ var1 = 0, $ var2 = 0 ){
If (! $ Var2 ){
$ Var2 = $ var1;
$ Var1 = 0;
}
If (is_numeric ($ var2 )){
$ Var2 = '@'. $ var2;
}
Try {
$ Date = new DateTime ($ var2 );
$ Date-> setTimezone (new DateTimeZone (date_default_timezone_get ()));
} Catch (Exception $ e) {$ date = 0 ;}
If (is_object ($ date )){
If ($ var1)
$ Date-> modify ($ var1 );
Return $ date-> format ('u ');
} Else {
Return 0;
}
}
Function fun_date ($ var1 = 0, $ var2 = 0 ){
If (! $ Var2 ){
$ Var2 = $ var1;
$ Var1 = 'Y-m-d H: I: s ';
}
Try {
$ Date = new DateTime ('@'. $ var2 );
$ Date-> setTimezone (new DateTimeZone (date_default_timezone_get ()));
} Catch (Exception $ e) {$ date = 0 ;}
If (is_object ($ date )){
Return $ date-> format ($ var1 );
} Else {
Return '';
}
}
The above is all the content described in this article. I hope it will help you learn php.
Returns the unixtime stamp conversion after January 1, 2038. the 2038unix usage is exactly the same as that of the old function. the code is as follows: function fun_strtotime ($ var1 = 0, $ var2 = 0) {if (! $ Var2...