You are here

public static function DatexObjectUtils::getdate in Datex 7

See php getdate().

File

datex_api/datex_api_classes.inc, line 1068
API and helper functions used by other datex modules.

Class

DatexObjectUtils
Utitilities to work with a DatexObject

Code

public static function getdate($timestamp = NULL) {
  if ($timestamp === NULL) {
    $timestamp = time();
  }
  $date = new DateTime($timestamp);
  $ret['seconds'] = intval($date
    ->format('s'));
  $ret['minutes'] = intval($date
    ->format('i'));
  $ret['hours'] = intval($date
    ->format('G'));
  $jalali = DatexFormatter::toJalali();
  $ret['mday'] = intval($jalali['day']);
  $ret['mon'] = intval($jalali['month']);
  $ret['year'] = intval($jalali['year']);
  $ret['wday'] = DatexFormatter::formatPHP($date, 'w');
  $ret['yday'] = DatexFormatter::formatPHP($date, 'z');
  $ret['weekday'] = DatexFormatter::formatPHP($date, 'l');
  $ret['month'] = DatexFormatter::formatPHP($date, 'F');
  $ret[0] = $timestamp;
  return $ret;
}