Dates
Last updated
Was this helpful?
Last updated
Was this helpful?
Date and time related utility functions.
Returns today's date as a DateTime object.
Syntax:
Parameters: None
Returns: DateTime
Example:
Returns today's date as string. By default, it returns the date in ISO format. The output format can be changed by the $pattern
parameter.
Syntax:
Parameters: $pattern
: How to format the output string. The default value is Y-m-d
Returns: string
Example:
Syntax:
Parameters: None
Returns: DateTime
Example:
Syntax:
Parameters: $pattern
: How to format the output string. The default value is Y-m-d
Returns: string
Example:
Syntax:
Parameters: None
Returns: DateTime
Example:
Syntax:
Parameters: $pattern
: How to format the output string. The default value is Y-m-d
Returns: string
Example:
Syntax:
Parameters: $startDate
: The first date
$endDate
: The second date
Returns: int
Example:
Syntax:
Parameters: $startDate
: The first date as string
$endDate
: The second date as string
Returns: int
Example:
Syntax:
Parameters: $originalDate
: The base date as string
$days
: Number of days to add
Returns: DateTime
Example:
Syntax:
Parameters: $originalDate
: The base time as string
$minutes
: Number of minutes to add
Returns: DateTime
Example:
Syntax:
Parameters: $actualDate
: The actual date as string
Returns: DateTime
Example:
Syntax:
Parameters: $timestamp
: The Unix timestamp to convert
Returns: DateTime
Example:
Syntax:
Parameters: $dateStr
: The date in string format to convert
Returns: int
Example:
Syntax:
Parameters: $startTime
: The start time in string format
$endTime
: The end time in string format
Returns: int
Example:
Syntax:
Parameters: None
Returns: DateTime
Example:
Returns yesterday's date as a DateTime object.
Returns yesterday's date as string. By default, it returns the date in ISO format. The output format can be changed by the $pattern
parameter.
Returns tomorrow's date as a DateTime object.
Returns tomorrow's date as string. By default, it returns the date in ISO format. The output format can be changed by the $pattern
parameter.
Returns the difference in days between two dates.
Returns the difference in days between two dates that are defined as strings.
Adds days to the original date and returns the new date as a DateTime object.
Adds minutes to the original time and returns the new time as a DateTime object.
Returns the last day of the month based on the specified date.
Converts the given Unix timestamp to a DateTime object.
Returns the Unix timestamp representation of a given date.
Gets the difference between two date times in minutes.
Returns the date one week from now.