Using Leaf Dates
Just like all of Leaf's other functionality, the dates module will also have to be imported. In v1.3, the
Date object has been renamed to
Date FunctionBasically, Date just gives you methods to manipulate the date and time, faster that
DateTime()would allow. Let's take a look at these methods.
randomTimestamp as the name implies, generates a new random timestamp. This method was
Timestamp in the previous version.
randomDate as the name implies, generates a new random date. This method is a new addition to the Date object.
This method returns the current time zone of the user
now returns the timestamp of the current date and time. Now will return the date based on the timezone, therefore, it is recommended to use
now together with
This method sets the timezone sets the timezone of the user. This method takes in one optional parameter, which is the timezone to set. If nothing is passed in there, the timezone is set to a GMT timezone.
This method gets the date in YYYY-MM-DD format from an existing timestamp
This gets the month in words from a number (1-12)
This gets the day in words from a number (1-7)
This gets the date in the format (MM DD, YYYY) from an existing timestamp
This gets the date in the format (DD MM, YYYY HH:MM:SS) from a timestamp
This gets the time in the format (HH:MM:SS) from a timestamp
Next StepsRe-routing to index.php