ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilCertificateDateHelper Class Reference
+ Collaboration diagram for ilCertificateDateHelper:

Public Member Functions

 formatDate ($date, ?int $dateFormat=null)
 
 formatDateTime ($dateTime, ?int $dateFormat=null)
 

Detailed Description

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

Definition at line 24 of file ilCertificateDateHelper.php.

Member Function Documentation

◆ formatDate()

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

Definition at line 29 of file ilCertificateDateHelper.php.

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

29  : string
30  {
31  if (null === $dateFormat) {
32  require_once 'Services/Calendar/classes/class.ilDateTime.php'; // Required because of global contant IL_CAL_DATE
33  $dateFormat = IL_CAL_DATETIME;
34  }
35 
36  $oldDatePresentationValue = ilDatePresentation::useRelativeDates();
38 
39  $date = ilDatePresentation::formatDate(new ilDate($date, $dateFormat));
40 
41  ilDatePresentation::setUseRelativeDates($oldDatePresentationValue);
42 
43  return $date;
44  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static setUseRelativeDates(bool $a_status)
set use relative dates
+ Here is the call graph for this function:

◆ formatDateTime()

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

Definition at line 50 of file ilCertificateDateHelper.php.

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

50  : string
51  {
52  if (null === $dateFormat) {
53  require_once 'Services/Calendar/classes/class.ilDateTime.php'; // Required because of global contant IL_CAL_DATE
54  $dateFormat = IL_CAL_DATETIME;
55  }
56 
57  $oldDatePresentationValue = ilDatePresentation::useRelativeDates();
59 
60  $date = ilDatePresentation::formatDate(new ilDateTime($dateTime, $dateFormat));
61 
62  ilDatePresentation::setUseRelativeDates($oldDatePresentationValue);
63 
64  return $date;
65  }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static setUseRelativeDates(bool $a_status)
set use relative dates
+ Here is the call graph for this function:

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