Date
class Date (View source)
Constants
| DB_FORMAT | 
                     The PHP date/time format string to be used when dealing with the database.  | 
            
Methods
Convert any date/time representation to a string that can be used in DB queries.
Return the date/time representation for now, that can be overridden by a custom request when viewing pages in a moment specified by administrators (custom request date/time).
Subsitute for the native date() function that adds localized date support.
Retrieve the display name (localized) of a time zone given its PHP identifier.
Returns a keyed array of timezone identifiers (keys are the standard PHP timezone names, values are the localized timezone names).
Returns the list of timezones with translated names, grouped by region.
Returns the display name of a timezone.
Describe the difference in time between now and a date/time in the past.
Returns the localized representation of a time interval specified as seconds.
Returns the normalized timezone identifier.
No description
Returns a \DateTimeZone instance for a specified timezone identifier.
Convert a date to a \DateTime instance.
Returns the difference in days between to dates.
Render the date part of a date/time as a localized string.
Render the time part of a date/time as a localized string.
Render both the date and time parts of a date/time as a localized string.
Render the date part of a date/time as a localized string. If the day is yesterday we'll print 'Yesterday' (the same for today, tomorrow).
Render both the date and time parts of a date/time as a localized string. If the day is yesterday we'll print 'Yesterday' (the same for today, tomorrow).
Render a date/time as a localized string, by specifying a custom format.
Returns the format string for the jQueryUI DatePicker widget
Returns the time format (12 or 24).
No description
Get the PHP date format string for times.
Get the PHP date format string for dates/times.
Details
        
                            string
    toDB(string|int|DateTimeInterface $value = 'now', string $fromTimezone = 'system')
        
    
    Convert any date/time representation to a string that can be used in DB queries.
        
                            string|int
    getOverridableNow(bool $asTimestamp = false)
        
    
    Return the date/time representation for now, that can be overridden by a custom request when viewing pages in a moment specified by administrators (custom request date/time).
        
                            string
    date(string $mask, bool|int $timestamp = false, string $toTimezone = 'system')
        
    
    Subsitute for the native date() function that adds localized date support.
Use ONLY if really needed: you may want to use some of the formatDate/Time methods. If you're not working with timestamps you may want to use the formatCustom method.
        
                            string
    getTimezoneName(string $timezoneID)
        
    
    Retrieve the display name (localized) of a time zone given its PHP identifier.
        
                            array
    getTimezones()
        
    
    Returns a keyed array of timezone identifiers (keys are the standard PHP timezone names, values are the localized timezone names).
        
                            array
    getGroupedTimezones()
        
    
    Returns the list of timezones with translated names, grouped by region.
        
                            string
    getTimezoneDisplayName(string|DateTimeZone|DateTimeInterface $timezone)
        
    
    Returns the display name of a timezone.
        
                            string
    timeSince(int $posttime, bool $precise = false)
        
    
    Describe the difference in time between now and a date/time in the past.
If the date/time is in the future or if it's more than one year old, you'll get the date representation of $posttime.
        
                            string
    describeInterval(int $diff, bool $precise = false)
        
    
    Returns the localized representation of a time interval specified as seconds.
        
                            string
    getTimezoneID(string $timezone)
        
    
    Returns the normalized timezone identifier.
        
                            string
    getUserTimeZoneID()
        
    
    No description
        
                            DateTimeZone|null
    getTimezone(string $timezone)
        
    
    Returns a \DateTimeZone instance for a specified timezone identifier.
        
                            DateTime|null
    toDateTime(string|DateTimeInterface|int $value = 'now', string $toTimezone = 'system', string $fromTimezone = 'system')
        
    
    Convert a date to a \DateTime instance.
        
                            int|null
    getDeltaDays(mixed $from, mixed $to, string $timezone = 'user')
        
    
    Returns the difference in days between to dates.
        
                            string
    formatDate(mixed $value = 'now', string $format = 'short', string $toTimezone = 'user')
        
    
    Render the date part of a date/time as a localized string.
        
                            string
    formatTime(mixed $value = 'now', bool $withSeconds = false, string $toTimezone = 'user')
        
    
    Render the time part of a date/time as a localized string.
        
                            string
    formatDateTime(mixed $value = 'now', bool $longDate = false, bool $withSeconds = false, string $toTimezone = 'user')
        
    
    Render both the date and time parts of a date/time as a localized string.
        
                            string
    formatPrettyDate(mixed $value, bool $longDate = false, string $toTimezone = 'user')
        
    
    Render the date part of a date/time as a localized string. If the day is yesterday we'll print 'Yesterday' (the same for today, tomorrow).
        
                            string
    formatPrettyDateTime(mixed $value, bool $longDate = false, bool $withSeconds = false, string $timezone = 'user')
        
    
    Render both the date and time parts of a date/time as a localized string. If the day is yesterday we'll print 'Yesterday' (the same for today, tomorrow).
        
                            string
    formatCustom(string $format, mixed $value = 'now', string $toTimezone = 'user', string $fromTimezone = 'system')
        
    
    Render a date/time as a localized string, by specifying a custom format.
        
                            string
    getJQueryUIDatePickerFormat(string $relatedPHPFormat = '')
        
    
    Returns the format string for the jQueryUI DatePicker widget
        
                            int
    getTimeFormat()
        
    
    Returns the time format (12 or 24).
        
                            string
    getPHPDatePattern()
        
    
    No description
        
                            string
    getPHPTimePattern()
        
    
    Get the PHP date format string for times.
        
                            string
    getPHPDateTimePattern()
        
    
    Get the PHP date format string for dates/times.
        
                            
    getLocalDateTime($systemDateTime = 'now', $mask = null)
        deprecated
    
    deprecated
No description
        
                            
    getSystemDateTime($userDateTime = 'now', $mask = null)
        deprecated
    
    deprecated
No description
        
                            
    dateTimeFormatLocal($datetime, $mask)
        deprecated
    
    deprecated
No description