There are a variety of ways to get timestamps in PHP, and usually get time is the UNIX timestamp and we normally see the time is not the same, then we need to format this, this article is about PHP gets to the current time and PHP to the UNIX
PHP date formatting and date calculation as well as getting the current week, month and tail date
PHP date formatting and date calculation as well as when getting previous week, month tail date
PHP date formatting Sample code:
/** * Format time
PHP date query function code
Date_default_timezone_set ('prc'); // Default time zone
Echo "today:", date ("Y-m-d", time ()),"";
Echo "today:", date ("Y-m-d", strtotime ("18 Jun 2008 ")),"";
Echo
$ceshi = "1417247764"; Time stamp format
First type:
$ceshi +86400;//The time stamp based on one day (i.e. 60*60*24)
The second type: $firstdaystr =date ("y-m-d h:i:s", $ceshi); Format timestamp, turn to normal format 2014-12-18
$end _time=strtotime
Ec (2); * & nbsp; converts a daytime date to a timestamp & nbsp; strtotime (time, now) parameter description & nbsp; time specifies the time string to be parsed. & Nbsp; now is used to calculate the timestamp of the returned value. If this parameter
This morning, I asked a question about the mysql database storage time. I suddenly thought about the date and time in php and mysql. In a project, we often use multiple expressions for the same time. For example, I used int (11) to store unix
Known Date: 2013-07-31 plus 12 months 3 months 1 months get the appropriate date
How can daniel write php code?
Reply to discussion (solution)
!--? php $date 1 = "2006-08-09"; Echo Date (' y-m-d ', Strtotime ("$date 1 +5 Day")), or,
Definitions and usageThe strftime () function formats the local time/date according to the locale setting.
GrammarStrftime (format,timestamp) parameter descriptionFormat is optional. Specify how the results are returned.Timestamp optional.Tips and
Use php to get detailed information about the timestamp of today, tomorrow, and yesterday. Use php to get the time. today, tomorrow, yesterday, the timestamp 2013-06-1? Phpecho today :. date (Y-m-d ). br; echo yesterday :. date (Y-m-d, strtotime
Get a timestamp of 0 points$time = strtotime (Date (' YMD '));
Get a timestamp of 24 O ' Day today$time = strtotime (Date (' YMD ')) + 86400;
Time stamp of the last day$date = Strtotime ('-1 days ');//获取当天的年份$y= date("Y"); //获取当天的月份$m= date("m");
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
Use PHP to get the time today tomorrow time stamp yesterday
2013-06-20 11:12
echo "Today:". Date ("y-m-d"). "
";
echo "Yesterday:". Date ("Y-m-d", Strtotime ("-1 Day")), "
";
echo "Tomorrow:". Date ("Y-m-d", Strtotime ("+1 Day")). "
";
echo "One
This article provides a detailed analysis of how to use php to obtain the timestamp of today, tomorrow, and yesterday. For more information, see use php to obtain the timestamp of today, tomorrow, and yesterday.
Echo "today:". date ("Y-m-d ")."
";
Phpstrtotime () function Time and Date conversion. In php, the strtotime () function resolves the date and time descriptions of any English text into Unix timestamps. This function is also frequently used. if you need it, please refer to it. Syntax
How does php add a day at a certain time? One hour? Time addition and subtraction
Date_default_timezone_set ('prc'); // Default time zone
Echo "today:", date ("Y-m-d", time ()),"
";
Echo "today:", date ("Y-m-d", strtotime ("18 Jun 2008 ")),"
";
Echo
Common date Operations
/**
* Get the start date of all weeks of the year
* @param $year format ' YYYY '
* Returns the two-dimensional array subscript key1 value corresponds to the actual year of the week of the year Key2
Use php to obtain the timestamp of today, tomorrow, and yesterday
Echo "Today:". date ("Y-m-d"). " ";
Echo "yesterday:". date ("Y-m-d", strtotime ("-1 day"), " ";
Echo "Tomorrow:". date ("Y-m-d", strtotime ("+ 1 day"). " ";
Echo "one week later:".
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.