DateTimeUtil Class Reference

Static Public Member Functions

static getTimeSinceDisplayContent ($dateTime)
static getMonthName ($month)
static getLocaleDateTimeFormat ()
static getLocaleDateTimeFormatForInput ()
static getLocaleDateFormat ($dateWidth=self::DATETIME_FORMAT_DATE_WIDTH)
static getLocaleDateFormatForInput ($dateWidth=self::DATETIME_FORMAT_DATE_WIDTH)
static getLocaleTimeFormat ($timeWidth=self::DATETIME_FORMAT_TIME_WIDTH)
static isLocaleTimeDisplayedAs12Hours ()
static resolveTimeStampForDateTimeLocaleFormattedDisplay ($value, $dateWidth=self::DATETIME_FORMAT_DATE_WIDTH, $timeWidth=self::DATETIME_FORMAT_TIME_WIDTH, $forInput=false)
static resolveValueForDateLocaleFormattedDisplay ($date, $displayFormat=null)
static resolveValueForDateDBFormatted ($value)
static convertFromUtcUnixStampByTimeZone ($utcTimeStamp, $timeZone)
static convertFromLocalUnixStampByTimeZoneToUtcUnixStamp ($utcTimeStamp, $timeZone)
static convertTimestampToDbFormatDate ($timestamp)
static convertTimestampToDbFormatDateTime ($timestamp)
static convertDbFormatDateTimeToTimestamp ($dbFormatDateTime)
static convertTimestampToDisplayFormat ($timestamp, $dateWidth=self::DATETIME_FORMAT_DATE_WIDTH, $timeWidth=self::DATETIME_FORMAT_TIME_WIDTH, $forInput=false)
static isValidDbFormattedDate ($date)
static isValidDbFormattedDateTime ($datetime)
static convertDbFormattedDateTimeToLocaleFormattedDisplay ($dbFormatDateTime, $dateWidth=self::DATETIME_FORMAT_DATE_WIDTH, $timeWidth=self::DATETIME_FORMAT_TIME_WIDTH, $forInput=false)
static convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero ($localeFormattedDateTime)
static convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay ($dateValue)
static convertDateIntoTimeZoneAdjustedDateTimeEndOfDay ($dateValue)
static convertDbFormattedDateTimeToTimeZoneAdjustedDateTime ($dateTime)
static getFirstDayOfAMonthDate ($stringTime=null)
static getLastDayOfAMonthDate ($stringTime=null)
static getFirstDayOfLastMonthDate ($stringTime=null)
static getLastDayOfLastMonthDate ($stringTime=null)
static getFirstDayOfNextMonthDate ($stringTime=null)
static getLastDayOfNextMonthDate ($stringTime=null)
static isDateValueNull (RedBeanModel $model, $attributeName)
static isDateStringNull ($date)
static isDateTimeValueNull (RedBeanModel $model, $attributeName)
static isDateTimeStringNull ($dateTime)
static resolveDateAsDateTime ($date)
static resolveDateTimeAsDate ($dateTime)
static getDatesBetweenTwoDatesInARange ($beginDate, $endDate)
static getWeekStartAndEndDatesBetweenTwoDatesInARange ($beginDate, $endDate)
static getMonthStartAndEndDatesBetweenTwoDatesInARange ($beginDate, $endDate)
static getFirstDayOfAWeek ($stringTime=null)
static getLastDayOfAWeek ($stringTime=null)
static getTodaysDate ()
static getFirstDayOfNextWeek ()
static getTomorrowsDate ()
static convertDateToDateTimeByTimeZoneOffset ($date)

Data Fields

const DATETIME_FORMAT_DATE_WIDTH = 'short'
const DATETIME_FORMAT_TIME_WIDTH = 'short'
const DISPLAY_FORMAT_FOR_INPUT = 'Display Format For Input'
const DISPLAY_FORMAT_ABBREVIATED_MONTH_ONLY_WIDTH = 'Display Format Abbreviated Month'
const DISPLAY_FORMAT_ABBREVIATED_MONTH_AND_DAY_WIDTH = 'Display Format Abbreviated Month And Day'

Detailed Description

Helper class for converting date time stamps between time zones and working with date formats and locales.

Definition at line 41 of file DateTimeUtil.php.


Member Function Documentation

static getTimeSinceDisplayContent ( dateTime  )  [static]

Given a datetime, return a string representation of how much time has elapsed since the $dateTime to now

Parameters:
$dateTime 
Returns:
string

Definition at line 58 of file DateTimeUtil.php.

static getMonthName ( month  )  [static]

Convert month to a display label. If the month is invalid then it just returns the month passed in.

Parameters:
string $month
Returns:
mixed

Definition at line 100 of file DateTimeUtil.php.

static getLocaleDateTimeFormat (  )  [static]

For the DateTime formatted attributes, get the locale specific date time format string.

Returns:
string - datetime format.

Definition at line 113 of file DateTimeUtil.php.

static resolveValueForDateLocaleFormattedDisplay ( date,
displayFormat = null 
) [static]

DateFormatter format can take a pattern found here: (See http://www.unicode.org/reports/tr35/#Date_Format_Patterns)

Parameters:
$date 
string $dateWidth
Returns:
null

Definition at line 178 of file DateTimeUtil.php.

static convertFromUtcUnixStampByTimeZone ( utcTimeStamp,
timeZone 
) [static]
Returns:
local timezone adjusted unix timestamp

Definition at line 223 of file DateTimeUtil.php.

static convertFromLocalUnixStampByTimeZoneToUtcUnixStamp ( utcTimeStamp,
timeZone 
) [static]
Returns:
timezone adjusted utc unix timestamp

Definition at line 234 of file DateTimeUtil.php.

static convertDateTimeLocaleFormattedDisplayToDbFormattedDateTimeWithSecondsAsZero ( localeFormattedDateTime  )  [static]

Given a locale formatted date time string. Convert to db formatted date time setting the seconds always as 00.

Parameters:
string $localeFormattedDateTime

Definition at line 323 of file DateTimeUtil.php.

static convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay ( dateValue  )  [static]

Given a db formatted date string, return the db formatted dateTime stamp representing the first minute of the provided date. This will be adjusted for the current user's timezone. Example: date provided is 1980-06-03, the first minute is '1980-06-03 00:00:00'. If the user is in Chicago then the time needs to be adjusted 5 or 6 hours forward depending on daylight savings time

Parameters:
string $dateValue - db formatted

Definition at line 347 of file DateTimeUtil.php.

static convertDateIntoTimeZoneAdjustedDateTimeEndOfDay ( dateValue  )  [static]

Given a db formatted date string, return the db formatted dateTime stamp representing the last minute of the provided date. This will be adjusted for the current user's timezone. Example: date provided is 1980-06-03, the first minute is '1980-06-03 23:59:59'. If the user is in Chicago then the time needs to be adjusted 5 or 6 hours forward depending on daylight savings time

Parameters:
string $dateValue - db formatted

Definition at line 362 of file DateTimeUtil.php.

static convertDbFormattedDateTimeToTimeZoneAdjustedDateTime ( dateTime  )  [static]
Parameters:
$dateTime 
Returns:
mixed

Definition at line 373 of file DateTimeUtil.php.

static getDatesBetweenTwoDatesInARange ( beginDate,
endDate 
) [static]

Given 2 dates in a range, return an array of all days that occur during that range

Parameters:
string $beginDate
string $endDate
Returns:
array

Definition at line 495 of file DateTimeUtil.php.

static getWeekStartAndEndDatesBetweenTwoDatesInARange ( beginDate,
endDate 
) [static]

Given 2 dates in a range, return an array of all weeks in the date range organized by start/end date of those months

Parameters:
string $beginDate
string $endDate
Returns:
array

Definition at line 517 of file DateTimeUtil.php.

static getMonthStartAndEndDatesBetweenTwoDatesInARange ( beginDate,
endDate 
) [static]

Given 2 dates in a range, return an array of all months in the date range organized by start/end date of those months

Parameters:
string $beginDate
string $endDate
Returns:
array

Definition at line 564 of file DateTimeUtil.php.

static getFirstDayOfAWeek ( stringTime = null  )  [static]

Gets first day of week.

Parameters:
string|null $stringTime
Returns:
string

Definition at line 609 of file DateTimeUtil.php.

static getLastDayOfAWeek ( stringTime = null  )  [static]

Gets last day of week.

Parameters:
string|null $stringTime
Returns:
string

Definition at line 623 of file DateTimeUtil.php.

static getTodaysDate (  )  [static]

Gets todays date.

Returns:
string

Definition at line 636 of file DateTimeUtil.php.

static getFirstDayOfNextWeek (  )  [static]

Get first day of next week.

Returns:
string

Definition at line 647 of file DateTimeUtil.php.

static getTomorrowsDate (  )  [static]

Gets tomorrows date.

Returns:
string

Definition at line 659 of file DateTimeUtil.php.

static convertDateToDateTimeByTimeZoneOffset ( date  )  [static]

Convert date to datetime by setting the h:i:s as offset hours, minutes and seconds.

Parameters:
string $date
Returns:
string

Definition at line 672 of file DateTimeUtil.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables
Generated on Wed Jul 26 07:10:23 2017