WIKINDX API trunk

DATE.php

WIKINDX : Bibliographic Management system.

Tags
see
https://wikindx.sourceforge.io/

The WIKINDX SourceForge project

author

The WIKINDX Team

license

https://www.isc.org/licenses/ ISC License

Table of Contents

Functions

timezoneOffsetFromUTC()  : string
Returns the timezone offset from UTC
localeDate2dbDate()  : string
Convert a datetime form the user timezone to the database timezone
dbDate2localeDate()  : string
Convert a datetime form the database timezone to user timezone
dateFormatFromString()  : string
Format dates and times for localization in numeric short format
dateFormatFromTimeStamp()  : string
Format dates and times for localization in numeric short format
getAllTimezones()  : array<string|int, string>
Return a selected list of all time zones recognised by PHP
determine_timezone()  : string
Determine the user's preferred timezone.
determine_timezone_priority_stack()  : array<string|int, string>
Determine the user's preferred timezone.

Functions

timezoneOffsetFromUTC()

Returns the timezone offset from UTC

timezoneOffsetFromUTC(string $timezone) : string

This function builds a timezone priority stack and return the first entry as the user's preferred timezone.

If $force_timezone is passed, this function will try to use this timezone first.

Parameters
$timezone : string
Return values
string

localeDate2dbDate()

Convert a datetime form the user timezone to the database timezone

localeDate2dbDate(string $datetime) : string

Use it for converting a date input by a user to store in the db as UTC.

If $datetime is not parseable then its value is returned unformated.

Parameters
$datetime : string

Comes in from the database in the format 'YYYY-MM-DD HH:MM:SS' e.g. 2013-01-31 15:54:55

Return values
string

dbDate2localeDate()

Convert a datetime form the database timezone to user timezone

dbDate2localeDate(string $datetime) : string

Use it for converting a date set inside a form field that must be displayed with user timezone.

If $datetime is not parseable then its value is returned unformated.

Parameters
$datetime : string

Comes in from the database in the format 'YYYY-MM-DD HH:MM:SS' e.g. 2013-01-31 15:54:55

Return values
string

dateFormatFromString()

Format dates and times for localization in numeric short format

dateFormatFromString(string $datetime) : string

Use it for displaying data to the user, not formatting data for the db.

If $datetime is not parseable then its value is returned unformated.

If IntlDateFormatter instanciation fails then the date is formated with "Y-M-d H:i:s" pattern.

Parameters
$datetime : string

Comes in from the database in the format 'YYYY-MM-DD HH:MM:SS' e.g. 2013-01-31 15:54:55

Return values
string

dateFormatFromTimeStamp()

Format dates and times for localization in numeric short format

dateFormatFromTimeStamp(int $timestamp) : string

Use it for displaying data to the user, not formatting data for the db.

If IntlDateFormatter instanciation fails then the date is formated with "Y-M-d H:i:s" pattern.

Parameters
$timestamp : int
Return values
string

getAllTimezones()

Return a selected list of all time zones recognised by PHP

getAllTimezones([bool $sorted_by_key = FALSE ]) : array<string|int, string>

Each entry of the returned array is English time zones name (taken from PHP) as key and its localized name as value.

Parameters
$sorted_by_key : bool = FALSE

If TRUE, sort the table by keys instead of values

Tags
see
https://www.php.net/manual/en/timezones.php
Return values
array<string|int, string>

determine_timezone()

Determine the user's preferred timezone.

determine_timezone([string|null $force_timezone = NULL ]) : string

This function builds a timezone priority stack and return the first entry as the user's preferred timezone.

If $force_timezone is passed, this function will try to use this timezone first.

Parameters
$force_timezone : string|null = NULL

Name of a timezone

Return values
string

determine_timezone_priority_stack()

Determine the user's preferred timezone.

determine_timezone_priority_stack([string|null $force_timezone = NULL ]) : array<string|int, string>

This function builds a timezone priority stack. The first is the highest priority.

If $force_timezone is passed, this function will try to use this timezone first.

Parameters
$force_timezone : string|null = NULL

Name of a timezone

Return values
array<string|int, string>

        
On this page

Search results