Description
Core\Moment moment( [int $seconds] )
Provides methods that are part of our cores Moment class that deals with time related functions.
Parameters
$seconds
Shorthand call to toString() method, which converts UNIX time to human readable time stamps.
Examples
<?php
route('/foo', function() {
// Prints the current UNIX time stamp
$time = moment()->now();
echo $time;
// Converts a UNIX time stamp to human readable time (e.g 1 second ago)
echo moment()->toString($time);
/**
* Short hand of the toString() method
*/
echo moment($time);
});
Methods
| Method | Description | Usage | Returns |
|---|---|---|---|
now()
| Get the current UNIX time stamp. | echo moment()->now(); // You can shorthand it as well echo moment(); | Returns current UNIX time stamp. |
| toString(int $seconds)
$seconds UNIX time stamp | Converts a UNIX time stamp to human readable | $time = moment()->now(); echo moment()->toString($time); /** * Short hand of the toString() method */ echo moment($time); | Examples based on time stamp...
|