FrostMVC\Date_Time
use FrostMVC\Date_Time;
Date and time utility methods.
| Property | Type | Description |
|---|---|---|
| Date_Time::$now | mixed |
| ::Convert() | — |
| ::ConvertToTimeZone() | Converts a timezone-aware date string from one timezone to another. |
| ::MySQLDate() | Formats a date/time string for MySQL storage. Returns a 'Y-m-d H:i:s' string by default, or 'Y-m-d' when $dateOnly is true. Returns false when the input is not parseable. |
| ::Now() | Returns and stores the current date/time in the given format. The result is cached in |
| ::PrettyDate() | Formats a date/time string as a human-readable 'Mon DD, YYYY' string. When $dateOnly is false, the time ('h:i a') is appended. |
| ::setTimeZone() | Sets the active PHP timezone for both date functions and the INI setting. |
| ::ToTime() | Formats a time string using the given format. Defaults to 'h:i A' (12-hour with AM/PM). |
Date_Time::Convert($intVal, $format = 'd')
No description yet.
| $intVal | mixed |
|
| $format | mixed |
Default: 'd' |
Date_Time::ConvertToTimeZone($dateString, $currentTimezone = false, $newTimezone = 'GMT', $format = 'Y-m-d H:i:s')
Converts a timezone-aware date string from one timezone to another.
| $dateString | string |
The date string to convert. |
| $currentTimezone | DateTimeZone|false |
Source timezone. Defaults to the PHP runtime timezone. Default:false |
| $newTimezone | string |
Target timezone identifier, e.g. 'UTC', 'America/New_York'. Default:'GMT' |
| $format | string |
Output format string for DateTime::format(). Default:'Y-m-d H:i:s' |
string
Date_Time::MySQLDate($strTime, $dateOnly = false)
Formats a date/time string for MySQL storage. Returns a 'Y-m-d H:i:s' string by default, or 'Y-m-d' when $dateOnly is true. Returns false when the input is not parseable.
| $strTime | string |
Any date/time string accepted by strtotime(). |
| $dateOnly | bool |
When true, returns only the date portion. Default:false |
string|false
Date_Time::Now($format = 'Y-m-d H:i:s')
Returns and stores the current date/time in the given format. The result is cached in Date_Time::$now.
| $format | string |
A PHP date() format string. Defaults to 'Y-m-d H:i:s'. Default:'Y-m-d H:i:s' |
string
Date_Time::PrettyDate($strTime, $dateOnly = false)
Formats a date/time string as a human-readable 'Mon DD, YYYY' string. When $dateOnly is false, the time ('h:i a') is appended.
| $strTime | string |
Any date/time string accepted by strtotime(). |
| $dateOnly | bool |
When true, omits the time portion. Default:false |
string
Date_Time::setTimeZone($timezone)
Sets the active PHP timezone for both date functions and the INI setting.
| $timezone | string |
A valid timezone identifier, e.g. 'Asia/Manila', 'UTC'. |
Date_Time::ToTime($time, $format = 'h:i A')
Formats a time string using the given format. Defaults to 'h:i A' (12-hour with AM/PM).
| $time | string |
Any time string accepted by strtotime(). |
| $format | string |
A PHP date() format string. Default:'h:i A' |
string
Generated from core/classes/Date_Time.php (FrostMVC ).