Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
UDateTime Class Reference

DateTime utilities Ubiquity\utils\base$UDateTime This class is part of Ubiquity. More...

Static Public Member Functions

static secondsToTime ($seconds)
 
static mysqlDate (\DateTime $date)
 
static mysqlDateTime (\DateTime $datetime)
 
static longDate ($date, $locale='en')
 
static shortDate ($date, $locale='en')
 
static shortDatetime ($datetime, $locale='en')
 
static longDatetime ($datetime, $locale='en')
 
static elapsed ($datetime, bool $full=false)
 

Data Fields

const MYSQL_DATETIME_FORMAT = 'Y-m-d H:i:s'
 
const MYSQL_DATE_FORMAT = 'Y-m-d'
 

Static Private Member Functions

static setLocale ($locale)
 

Static Private Attributes

static $locales = ['fr' => ['fr', 'fr_FR', 'fr_FR.UTF-8'], 'en' => ['en', 'en_US', 'en_US.UTF-8']]
 

Detailed Description

DateTime utilities Ubiquity\utils\base$UDateTime This class is part of Ubiquity.

Author
jcheron myadd.nosp@m.ress.nosp@m.mail@.nosp@m.gmai.nosp@m.l.com
Version
1.0.2

Definition at line 14 of file UDateTime.php.

Member Function Documentation

◆ elapsed()

static elapsed (   $datetime,
bool  $full = false 
)
static
Parameters
string | \DateTime$datetime
boolean$full
Returns
string
Exceptions

Exception

See also
http://stackoverflow.com/questions/1416697/converting-timestamp-to-time-ago-in-php-e-g-1-day-ago-2-days-ago

Definition at line 67 of file UDateTime.php.

◆ longDate()

static longDate (   $date,
  $locale = 'en' 
)
static

Definition at line 39 of file UDateTime.php.

◆ longDatetime()

static longDatetime (   $datetime,
  $locale = 'en' 
)
static

Definition at line 54 of file UDateTime.php.

◆ mysqlDate()

static mysqlDate ( \DateTime  $date)
static

Definition at line 31 of file UDateTime.php.

◆ mysqlDateTime()

static mysqlDateTime ( \DateTime  $datetime)
static

Definition at line 35 of file UDateTime.php.

◆ secondsToTime()

static secondsToTime (   $seconds)
static

Definition at line 24 of file UDateTime.php.

◆ setLocale()

static setLocale (   $locale)
staticprivate

Definition at line 19 of file UDateTime.php.

◆ shortDate()

static shortDate (   $date,
  $locale = 'en' 
)
static

Definition at line 44 of file UDateTime.php.

◆ shortDatetime()

static shortDatetime (   $datetime,
  $locale = 'en' 
)
static

Definition at line 49 of file UDateTime.php.

Field Documentation

◆ $locales

$locales = ['fr' => ['fr', 'fr_FR', 'fr_FR.UTF-8'], 'en' => ['en', 'en_US', 'en_US.UTF-8']]
staticprivate

Definition at line 17 of file UDateTime.php.

◆ MYSQL_DATE_FORMAT

const MYSQL_DATE_FORMAT = 'Y-m-d'

Definition at line 16 of file UDateTime.php.

◆ MYSQL_DATETIME_FORMAT

const MYSQL_DATETIME_FORMAT = 'Y-m-d H:i:s'

Definition at line 15 of file UDateTime.php.


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