API Documentation for: 1.1.1
Show:

DateUtils Class

Namespace: Canteen\Utilities

The collection of date related utilities

Item Index

Methods

Methods

addDisplay

(
  • object
  • [key='created']
)
Array static

Add date display to multiple objects or collection of objects. Can be run recursively if there are nested objects or arrays.

Parameters:

  • object Array

    The collection of objects

  • [key='created'] String optional

    The data key to update

Returns:

Array:

The updated objects collection

display

(
  • date
  • [format=null]
)
static

The global date formatting.

Parameters:

  • date Date | Int

    The string date or number of seconds

  • [format=null] String optional

    The optional format

readable

(
  • timestamp
)
String private static

Represent a timestamp as a human readable time

Parameters:

  • timestamp Int

    The number of seconds

Returns:

String:

The readable date

toDatabase

(
  • time
  • [short=false]
)
String static

Convert a date to mysql format

Parameters:

  • time String

    The input date format

  • [short=false] Boolean optional

    If we should do the date format only, default is datetime

Returns:

String:

The format suitable for database