Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_Lib_Date class

• Introduction

Date/time library.

• Class synopsis

AMI_Lib_Date {
/* Constants */
const AMI_Lib_Date::FMT_BOTH =  'PHP';
const AMI_Lib_Date::FMT_BOTH_ZONE =  'PHP_ZONE';
const AMI_Lib_Date::FMT_DATE =  'PHP_DATE';
const AMI_Lib_Date::FMT_TIME =  'PHP_TIME';
const AMI_Lib_Date::FMT_UNIX =  'UNIX';
// Maximum possible unix time
const AMI_Lib_Date::UTIME_MAX =  2019664799;
// Minimum possible unix time
const AMI_Lib_Date::UTIME_MIN =  315511200;
/* Properties */
// Date/time formats
protected static array $aFormats = array( 'PHP' => 'Y-m-d H:i:s', 'PHP_ZONE' => 'Y-m-d H:i:s e', 'PHP_DATE' => 'Y-m-d', 'PHP_TIME' => 'H:i:s' );
/* Methods */
// Date/time formatter.
public static formatDateTime ( string $value, [ string $format = self::FMT_DATE ], [ bool $bToSQL = false ] ) returns string;
// Returns formatted unix time.
public static formatUnixTime ( int $utime, [ string $format = self::FMT_DATE ] ) returns string;
// Re
public static getFormat ( int $type ) returns string;
}
Tags:
since 5.12.0

• Class Constants

FMT_BOTH
FMT_BOTH_ZONE
FMT_DATE
FMT_TIME
FMT_UNIX
UTIME_MAX

Maximum possible unix time

UTIME_MIN

Minimum possible unix time

• Class Properies

protected static array $aFormats

Date/time formats

• Class Methods

// Date/time formatter.
public static formatDateTime ( string $value, [ string $format = self::FMT_DATE ], [ bool $bToSQL = false ] ) returns string;
  • string $value
    Date to format
  • string $format
    Format: AMI_Lib_Date::FMT_DATE, AMI_Lib_Date::FMT_TIME or AMI_Lib_Date::FMT_BOTH
  • bool $bToSQL
    Return MySQL specific formatted date
  Example:
Tags:
since 5.12.4
// Returns formatted unix time.
public static formatUnixTime ( int $utime, [ string $format = self::FMT_DATE ] ) returns string;
  • int $utime
    Unix time
  • string $format
    Format: AMI_Lib_Date::FMT_DATE, AMI_Lib_Date::FMT_TIME or AMI_Lib_Date::FMT_BOTH
// Re
public static getFormat ( int $type ) returns string;
  • int $type
    self::FMT_DATE } self:: | self::FMT_TIME | FMT_BOTH
Tags:
since 6.0.4