1. Time Format function date (Format,timestamp)
Format
Time format
Timestamp
Time stamp
Some of the characters commonly used in dates are listed below:
D-Represents the day of the month (01
The details are as follows:1> if we know the start time, we need to add or subtract a time to get a result time, you can use the following code$ Time1 = '2017-10-1 12:30:30 ';Echo date ('Y-m-d H: I: s', strtotime ($ time1) + 30*60); // pay attention
Problem Description: Using date () to get server time in a PHP script is always a few hours from the actual time.Possible cause: A problem with the setting of the time zone in the PHP configuration fileWorkaround:Method 1. php.ini file in
Share the Control List of PHP time formats. The format character specifies the return value. for example, the day in the month ------ d, the number of the day in the month contains the 2nd digit of the leading zero, 01 to 31j, and no leading zero, 1
Php time is determined to be in a certain period of time. for example, if the "senior member" date displayed in 2014/5/21-2014/5/31 is later than, "the member has expired" is displayed. what should I do?
Reply to discussion (solution)
How did
PHP Time Call Issue
Do not understand the PHP programming, ask:
Want to achieve, * minutes ago (* hours ago ...) ), do not know how to compile, find a piece of code on the Internet, very useful, but also very simple:
PHP Code
'
Introduction: This is a detailed page of common PHP time functions. It introduces the related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 324390
The details are as follows:
1> if we know the start time, we need to add or subtract a time to get a result time, you can use the following
Code
$ Time1 = '2017-10-1 12:30:30 ';Echo date ('Y-m-d h: I: s', strtotime ($ time1) + 30*60); // pay
$ Regdatedate (& quot; Y-m-d & quot ;) when I log in to the database but check the database after registration, the logtime shows. why is it displayed when I use the output statement? How to Change ------ solution ------------------ In fact, you
The correct method for modifying the PHP time zone is described in detail. 1. modify the PHP. ini file to find the date. timezone line. remove the semicolon and change it to date. timezoneAsiaShanghai2. modify the. htaccess file to modify the.
$now =time ();
$SEC//term time minus current time remaining time$sec% 60;//to get the number of seconds$nowtime =floor ($secondtime/60);//Convert to minutes$minute = $nowtime% 60;//Get minutes$nowtime =floor ($nowtime/60);//Convert into hours$hour
Previously, we used the strtotime () function to compare the size of two dates. apart from comparing the size of two dates, PHP can also accurately calculate the difference between two dates. In this chapter, we still use the strtotime () function
Php time zone conversion function. The copy code is as follows: ** time zone conversion ** functiontoTimeZone ($ src, $ from_tzAmericaDenver, $ to_tzAsiaShanghai, $ fmY-m-dH: I: s) {$ datetimenewDateTime ($ sr
The code is as follows:
/** Time
PHP how to generate a date timeline, PHP, a date function of the application instance, the Unix timestamp into the timeline, through this example can grasp the use of the date function.
Example, PHP time axis function code.Copy Codecode
Common PHP time operation functions
1. determine the day of the week
/**
* Determine the day of the week.
* @ Param $ date: 'yyyy-mm-DD'. If an error occurs, false is returned. If yes, a day from Monday to Sunday is
Date_default_timezone_set (' Asia/shanghai '); Setting the time zone
One, format time function date, return string
@params
String Date (String param1,intparam1,inttime)
1.date functions (vs. printf, sprintf functions)
Date (' Time format ' [, '
This article is about the PHP time function strtotime Use of the detailed, has a certain reference value, now share to everyone, the need for friends can refer to
Definition and Usage strtotime ()The strtotime () function resolves the
Php time-friendly formatting
-->
$velocityCount-->
-->
[PHP] code
'% S DAY before', 'day _ hour' => '% s DAY Before % s HOUR', 'hour '=>' % s HOUR ', 'hour _ MINUTE '=>' % s HOUR % s before ', 'Minute' => '% s Minutes Ago ', 'minute _ second' =>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.