date_time.php
Table of Contents
Constants
- TIMEZONE = "Europe/Prague"
- The default timezone identifier used for date and time operations.
Functions
- convertStringToDateTime() : DateTime
- Converts a date string into a DateTime object.
- getDateTimeNow() : DateTime
- Retrieves the current date and time.
Constants
TIMEZONE
The default timezone identifier used for date and time operations.
public
string
TIMEZONE
= "Europe/Prague"
Functions
convertStringToDateTime()
Converts a date string into a DateTime object.
convertStringToDateTime(string $date) : DateTime
This function creates a new DateTime instance based on the provided string, explicitly setting the timezone to the global constant TIMEZONE.
Parameters
- $date : string
-
The string representation of the date (e.g., "2023-10-25" or "now").
Tags
Return values
DateTime —The resulting DateTime object set to the configured timezone.
getDateTimeNow()
Retrieves the current date and time.
getDateTimeNow() : DateTime
Creates a DateTime object representing the current moment, configured with the application's default timezone.
Tags
Return values
DateTime —The current date and time.