/
Time/Date Functions

Time/Date Functions

FreePBX 14 includes the ability to utilize date/time formats per user or globally. To support these options you will need to use the following functions:

getDate

When passed a unix timestamp this function will return a formatted date string

$timestamp = '1499681688'; FreePBX::View()->getDate($timestamp); 7/10/2017

You can also pass null to get the current date

FreePBX::View()->getDate(); 7/11/2017

getTime

When passed a unix timestamp this function will return a formatted time string

$timestamp = '1499681688'; FreePBX::View()->getTime($timestamp); 3:14 AM

You can also pass null to get the current date

getDateTime

When passed a unix timestamp this function will return a formatted date/time string

You can also pass null to get the current date/time

getMoment

When passed a timestamp this function will return a moment PHP object. For more information see: GitHub - fightbulc/moment.php: Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js

You can also pass null to get the current moment object

getLocale

Will return the current locale in the format of en_US

 

Return to Documentation Home I Return to Sangoma Support