Categories
PHP

The DateInterval Class

How to add or subtract a date/time period from a DateTime object using the add() and sub() methods.

Categories
PHP

The DateTimeZone Class

This tutorial describes how to represent times in different parts of the world.

Categories
PHP

The DateTime Class

The DateTime class deals with a wide range of date and time calculations, it provides an object-oriented interface to accurately create and manipulate dates and times.

Categories
PHP

Calculating Dates

Learn how to calculate the difference between two date and time strings. Also, how to find the leap year from a list of years.

Categories
PHP

Converting and Parsing a String into Date & Time

How to guess the date and time from a string with the help of strtotime() function and change the format according to your needs. You’ll also use the date_parse() and date_parse_from_format() functions which work similarly to the strtotime() function and return an associative array of date and time information.

Categories
PHP

Get Time of day, UTC offset, and DST

The gettimeofday() function executes the underlying gettimeofday(2) system call, it returns the current time (expressed as seconds and microseconds since the Epoch), time zone, and daylight saving time correction information.

Categories
PHP

Converting a Timestamp to Date and Time

In this tutorial, you learn how to get a local date and time with getdate() function, convert a timestamp into date and time with getdate() and date() functions, and convert a date and time into a timestamp with strtotime and mktime functions.

Categories
PHP

Validating a Date

Learn how to validate a date with the help of checkdate() function.

Categories
PHP

Formatting Date and Time

In this tutorial, we’ll discuss the date(), gmdate() and idate() functions. We’ll use these functions to convert a timestamp to readable date and time format, to change the format of a date or time, and to format the current date and time.

Categories
PHP

Generating a Timestamp

A UNIX timestamp is an integer that gives us the number of seconds that have elapsed since January 1 1970 00:00:00 UTC (or GMT). In this tutorial, you’ll find many ways to generate a Unix timestamp for the current or a specific Date and Time.