ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCertificateDateHelper Class Reference
+ Collaboration diagram for ilCertificateDateHelper:

Public Member Functions

 formatDate (string $date, $dateFormat=null)
 
 formatDateTime (string $dateTime, $dateFormat=null)
 

Detailed Description

Author
Niels Theen nthee.nosp@m.n@da.nosp@m.tabay.nosp@m..de

Definition at line 7 of file ilCertificateDateHelper.php.

Member Function Documentation

◆ formatDate()

ilCertificateDateHelper::formatDate ( string  $date,
  $dateFormat = null 
)
Parameters
string$date
int$dateFormat
Returns
string

Definition at line 14 of file ilCertificateDateHelper.php.

References ilDatePresentation\formatDate(), IL_CAL_DATETIME, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

14  : string
15  {
16  if (null === $dateFormat) {
17  $dateFormat = IL_CAL_DATETIME;
18  }
19 
20  $oldDatePresentationValue = ilDatePresentation::useRelativeDates();
22 
23  $date = ilDatePresentation::formatDate(new ilDate($date, $dateFormat));
24 
25  ilDatePresentation::setUseRelativeDates($oldDatePresentationValue);
26 
27  return $date;
28  }
const IL_CAL_DATETIME
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
Class for single dates.
+ Here is the call graph for this function:

◆ formatDateTime()

ilCertificateDateHelper::formatDateTime ( string  $dateTime,
  $dateFormat = null 
)
Parameters
string$dateTime
int$format
Returns
string
Exceptions
ilDateTimeException

Definition at line 36 of file ilCertificateDateHelper.php.

References ilDatePresentation\formatDate(), IL_CAL_DATETIME, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

36  : string
37  {
38  if (null === $dateFormat) {
39  $dateFormat = IL_CAL_DATETIME;
40  }
41 
42  $oldDatePresentationValue = ilDatePresentation::useRelativeDates();
44 
45  $date = ilDatePresentation::formatDate(new ilDateTime($dateTime, $dateFormat));
46 
47  ilDatePresentation::setUseRelativeDates($oldDatePresentationValue);
48 
49  return $date;
50  }
const IL_CAL_DATETIME
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static useRelativeDates()
check if relative dates are used
Date and time handling
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: