Date & Time Libraries



( ZN >= 2.0.0 )

A class that performs functions related to Date and Time. This library also uses special cycles other than the standard date and time formats. Thus, more memorable date and time terms are made available. In this section, two librarians, namely Date and Time, are mentioned. Although the work that both librarians do is the same, there are minor differences in character sets and localizations.

 

# Custom Cycles


The purpose of these cycles is to use clearer and more understandable date-time expressions. The use of these cycles is not compulsory. If desired, it can be used in classical date and time expressions.

Common Date and Time Cycles meaning Provisions
{shortDayName} | {shortDay} | {SDE} The abbreviated version of the day. Mon, Sun
{dayName} | {day} | {D} Full name of the day. Monday, Sunday
{dayNumber0} | {dayNum0} | {DN0} Two-digit day of the moon. 01  -  31
{dayNumber} | {dayNum} | {DN} Single-digit day of the moon. 1  -  31
{yearDayNumber0} | {yearDayNum0} | {YDN} 3 digit day of the year . 001  -  366
{weekDayNumber} | {weekDayNum} | WDN {} A numerical representation of the day of the week that begins with 1 den. 1 (Monday) - 7 (Sunday)
{weekNumber} | {weekNum} | {WN} A numerical representation of the day of the week starting from 0 . 0 (Sunday) - 6 (Saturday)
{shortMonthName} | {shortMonth} | {SM} Abbreviated month name Jan, Dec
{monthName} | {month} | {mon} Full moon name. January, December
{monthNumber0} | {monNum0}
{monthNumber} | {monNum}
{MN} | Mn0 {}
Numerical representation of a two-digit month. 01  (January) -  12  (fDecember)
{shortYear} | {SY} Two-digit display of the year. 18 ( 2018 ) - 20 ( 2020 )
{year} | {Y} Full display of the year. 2018 - 2020
{hour} | {hour024} | {H024} Two-digit display of the clock in 24- hour format. 00 - 23
{hour24} | {H24} Single-digit display of the clock in 24- hour format. 0 - 23
{hour012} | {H012} The clock 12 two-digit representation of the hour format 01 - 12
{hour12} | {H12} The clock 12 two-digit representation of the hour format 1 - 12
{minute0} | {minute} | {min} | {min0} Two-digit display of minutes. 00 - 59
{AMPM} | {PM} AM - PM indication with upper case according to the given time. AM  for 00:31,  PM  for 22:23
{ampm} | {am} Am - pm indication in lower case according to the given time. am  for 00:31,  pm  for 22:23
{second} | {second0} | {sec} | {sec0} Your two-digit display. 00 - 59

 

# Methods


String set ( String $ exp )
String calculate ( String $ input , String $ calculate , String $ output = 'Ym-d' )
Bool compare ( String $ value1 , String $ condition , String $ value2 )
Int toNumeric ( String $ dateFormat , Int $ now = NULL )
String toReadable ( Int $ now = NULL , String $ dateFormat = 'Ymd H: i: s' )
String convert ( String $ date , String $ format )
String standard()
String current ( String $ clock )

 

 

# Set ( ZN >= 2.0.0 )


Used to create a current date and time expression.

Parameters

String $ exp Date time expression.
return String

Use of

echo Date::set('{day}');
echo Date::set('{monNum}-{mon} {day}');
echo Date::set('{H024}:{min}:{sec}');
echo Date::set('{dayNumber0}.{monthNumber}.{year} {hour024}:{minute}:{second}');
Sunday
2-February Sunday
15:46:52
08.2.2015 15:47:06

 

# Calculate ( ZN >= 3.0.0 )


It is used to perform operations such as addition and subtraction on history information

Parameters

String $ input Date entered.
String $ Calculate The value to add or remove.
String $ output The idiomatic sequence of the output.
return String

Use of

echo Date::calculate('{year}-{monthNumber}-{dayNumber}', '30 day');
echo Date::calculate('01/12/2015', '-30 day', '{dayNumber}-{monthNumber}-{year}');
2017-01-30
01-11-2015

You can use the time calculation as follows.

echo Time::calculate('10:30', '-30 minutes', '{hour}:{minute}');
10:00

 

# Compare ( ZN >= 3.0.0 )


Used to compare date information.

Parameters

String $ value1 1. history information.
String $ Compare Comparison statement.
String $ output 2. date information
return Bool

Use of

echo Date::compare('2015-02-15', '>', '2015-02-14'); 
true

 

# ToNumeric ( ZN >= 3.0.0 )


Used to convert date information to numeric data.

Parameters

String $ DateFormat Date format.
Int $ now = NULL The timestamp used as a base for the computation of relative dates.
return Int

Use of

echo Date::toNumeric('2015-02-15');
1423951200 

 

# ToReadable ( ZN >= 5.3.5 )


It converts the numeric data into readable date and time.

Parameters

Int $ Time Digital data.
String $ DateFormat Date format.
return String

Use of

echo Date::toReadable('1423951200', '{year}-{monthNumber}-{dayNumber}');
2015-02-15

 

# Convert ( ZN> = 3.0.0 )


Used to change the format of date information.

Parameters

String $ Date History information.
String $ newformat The new form of history.
return String

Use of

echo Date::convert('2015-02-15', '{dayNumber}/{monthNumber}/{year}');
15/02/2015

 

# Standard ( ZN >= 2.0.0 )


Used to retrieve standard date and time information. If this method is used with the Time class, it is translated according to the language of the region selection.

Parameters

void
return String

Use of

echo Date::standart();
echo Time::standart(); 
20.February.2016 Saturday, 12:46:55 20.Feb.2016
Saturday, 12:46:55

 

# Current ( ZN >= 2.0.0 )


This method Time class is used with active hours , the Date class is used with active date gives the information.

Parameters

void
return String

ull strength

echo Date::current();
echo Time::current();
20.02.2016
12:52:45