ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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
?int$dateFormat
Returns
string

Definition at line 31 of file ilCertificateDateHelper.php.

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

31  : string
32  {
33  if (null === $dateFormat) {
34  require_once 'Services/Calendar/classes/class.ilDateTime.php'; // Required because of global contant IL_CAL_DATE
35  $dateFormat = IL_CAL_DATETIME;
36  }
37 
38  $oldDatePresentationValue = ilDatePresentation::useRelativeDates();
40 
41  $date = ilDatePresentation::formatDate(new ilDate($date, $dateFormat));
42 
43  ilDatePresentation::setUseRelativeDates($oldDatePresentationValue);
44 
45  return $date;
46  }
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
?int$dateFormat
Returns
string
Exceptions
ilDateTimeException

Definition at line 54 of file ilCertificateDateHelper.php.

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

54  : string
55  {
56  if (null === $dateFormat) {
57  require_once 'Services/Calendar/classes/class.ilDateTime.php'; // Required because of global contant IL_CAL_DATE
58  $dateFormat = IL_CAL_DATETIME;
59  }
60 
61  $oldDatePresentationValue = ilDatePresentation::useRelativeDates();
63 
64  $date = ilDatePresentation::formatDate(new ilDateTime($dateTime, $dateFormat));
65 
66  ilDatePresentation::setUseRelativeDates($oldDatePresentationValue);
67 
68  return $date;
69  }
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: