Most computers store dates and times as UNIX timestamps, or simply timestamps. A timestamp is an integer that holds the number of seconds between midnight UTC on January 1, 1970 and the date and times …
Read More »Date and Time functions in PHP
Getting the Current Date and Time In PHP
Computers include Web servers, as well as your own PC and keep track of the current date and time using a built-in clock. You can access this clock’s value with the PHP time() function, which …
Read More »Creating Your Own Timestamps
creating-your-own-timestamps The time() Function is useful for getting the current time but if you want to work with other dates and times. You can use various PHP functions to create timestamps for storing dates and …
Read More »Creating Timestamps from Date and Time Values In PHP
The mktime() function returns a timestamp based on up to six time/date arguments, as follows: Hour (0 – 23) Minute (0 – 59) Second (0 – 59) Month (1 – 12) Day of the month …
Read More »Creating Timestamps from GMT Date and Time Values
mktime() assumes that the arguments you pass are in your computer’s time zone, it converts the supplied time to UTC so that it can be returned as a timestamp. However, sometimes it is useful to …
Read More »Creating Timestamps from Date and Time Strings In PHP
mktime() is great if you already have the individual numeric values for the date and time you want to store. However, often the PHP script will receive a date or time as a string. For …
Read More »Extracting Date and Time Values from a Timestamps In PHP
Now you know how to create timestamps from time/date values and strings. You can also go the other way, and convert a timestamp to its corresponding date and time components. getdate() accepts a timestamp and …
Read More »