|
Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
|
Static Public Member Functions | |
| static | convertIsoDate (mixed $value) |
| static | dateTimeFromTimestamp (string $date, ?DateTimeZone $timeZone=null) |
| static | dateTimeToExcel (DateTimeInterface $dateValue) |
| Convert a PHP DateTime object to an MS Excel serialized date/time value. | |
| static | dayStringToNumber (string $day) |
| Strips an ordinal from a numeric value. | |
| static | excelToDateTimeObject (float|int $excelTimestamp, null|DateTimeZone|string $timeZone=null) |
| Convert a MS serialized datetime value from Excel to a PHP Date/Time object. | |
| static | excelToTimestamp ($excelTimestamp, $timeZone=null) |
| Convert a MS serialized datetime value from Excel to a unix timestamp. | |
| static | formattedDateTimeFromTimestamp (string $date, string $format, ?DateTimeZone $timeZone=null) |
| static | formattedPHPToExcel (int $year, int $month, int $day, int $hours=0, int $minutes=0, float|int $seconds=0) |
| formattedPHPToExcel. | |
| static | getDefaultOrLocalTimezone () |
| Return the Default timezone, or local timezone if default is not set. | |
| static | getDefaultTimezone () |
| Return the Default timezone, or UTC if default not set. | |
| static | getDefaultTimezoneOrNull () |
| Return the Default timezone even if null. | |
| static | getExcelCalendar () |
| Return the Excel calendar (Windows 1900 or Mac 1904). | |
| static | isDateTime (Cell $cell, mixed $value=null, bool $dateWithoutTimeOkay=true) |
| Is a given cell a date/time? | |
| static | isDateTimeFormat (NumberFormat $excelFormatCode, bool $dateWithoutTimeOkay=true) |
| Is a given NumberFormat code a date/time format code? | |
| static | isDateTimeFormatCode (string $excelFormatCode, bool $dateWithoutTimeOkay=true) |
| Is a given number format code a date/time? | |
| static | monthStringToNumber (string $monthName) |
| Converts a month name (either a long or a short name) to a month number. | |
| static | PHPToExcel (mixed $dateValue) |
| Convert a date from PHP to an MS Excel serialized date/time value. | |
| static | roundMicroseconds (DateTime $dti) |
| Round the given DateTime object to seconds. | |
| static | setDefaultTimezone ($timeZone) |
| Set the Default timezone to use for dates. | |
| static | setExcelCalendar (?int $baseYear) |
| Set the Excel calendar (Windows 1900 or Mac 1904). | |
| static | stringToExcel (string $dateValue) |
| Convert a date/time string to Excel time. | |
| static | timestampToExcel ($unixTimestamp) |
| Convert a Unix timestamp to an MS Excel serialized date/time value. | |
Public Attributes | |
| const | CALENDAR_MAC_1904 = 1904 |
| file home runner work phpdoc phpdoc moodle lib phpspreadsheet phpspreadsheet src PhpSpreadsheet Shared Date php const | CALENDAR_WINDOWS_1900 = 1900 |
| constants | |
Static Public Attributes | |
| static string[] array | $monthNames |
| Names of the months of the year, indexed by shortname Planned usage for locale settings. | |
| static string[] array | $numberSuffixes |
Static Protected Attributes | |
| static DateTimeZone | $defaultTimeZone = null |
| Default timezone to use for DateTime objects. | |
| static int | $excelCalendar = self::CALENDAR_WINDOWS_1900 |
| Base calendar year to use for calculations Value is either CALENDAR_WINDOWS_1900 (1900) or CALENDAR_MAC_1904 (1904). | |
|
static |
| mixed | $value | Converts a date/time in ISO-8601 standard format date string to an Excel serialized timestamp. See https://en.wikipedia.org/wiki/ISO_8601 for details of the ISO-8601 standard format. |
|
static |
Convert a PHP DateTime object to an MS Excel serialized date/time value.
| DateTimeInterface | $dateValue | PHP DateTime object |
| float | MS Excel serialized date/time value |
|
static |
Strips an ordinal from a numeric value.
| string | $day | Day number with an ordinal |
| int|string | The integer value with any ordinal stripped, or the original string argument if it isn't a valid numeric |
|
static |
Convert a MS serialized datetime value from Excel to a PHP Date/Time object.
| float | int | $excelTimestamp | MS Excel serialized date/time value |
| null | DateTimeZone | string | $timeZone | The timezone to assume for the Excel timestamp, if you don't want to treat it as a UTC value Use the default (UTC) unless you absolutely need a conversion |
| DateTime | PHP date/time object |
|
static |
Convert a MS serialized datetime value from Excel to a unix timestamp.
The use of Unix timestamps, and therefore this function, is discouraged. They are not Y2038-safe on a 32-bit system, and have no timezone info.
| float | int | $excelTimestamp | MS Excel serialized date/time value |
| null | DateTimeZone | string | $timeZone | The timezone to assume for the Excel timestamp, if you don't want to treat it as a UTC value Use the default (UTC) unless you absolutely need a conversion |
| int | Unix timetamp for this date/time |
|
static |
formattedPHPToExcel.
| float | Excel date/time value |
|
static |
Return the Excel calendar (Windows 1900 or Mac 1904).
| int | Excel base date (1900 or 1904) |
|
static |
Converts a month name (either a long or a short name) to a month number.
| string | $monthName | Month name or abbreviation |
| int|string | Month number (1 - 12), or the original string argument if it isn't a valid month name |
|
static |
Convert a date from PHP to an MS Excel serialized date/time value.
| mixed | $dateValue | PHP DateTime object or a string - Unix timestamp is also permitted, but discouraged; not Y2038-safe on a 32-bit system, and no timezone info |
| false|float | Excel date/time value or boolean FALSE on failure |
|
static |
Set the Default timezone to use for dates.
| null | DateTimeZone | string | $timeZone | The timezone to set for all Excel datetimestamp to PHP DateTime Object conversions |
| bool | Success or failure |
|
static |
Set the Excel calendar (Windows 1900 or Mac 1904).
| ?int | $baseYear | Excel base date (1900 or 1904) |
| bool | Success or failure |
|
static |
Convert a date/time string to Excel time.
| string | $dateValue | Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10' |
| false|float | Excel date/time serial value |
|
static |
Convert a Unix timestamp to an MS Excel serialized date/time value.
The use of Unix timestamps, and therefore this function, is discouraged. They are not Y2038-safe on a 32-bit system, and have no timezone info.
| float | int | string | $unixTimestamp | Unix Timestamp |
| false|float | MS Excel serialized date/time value |
|
static |
Names of the months of the year, indexed by shortname Planned usage for locale settings.
|
static |