Overview
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
Date Function
Basically, Date just gives you methods to manipulate the date and time, faster thatDateTime()
would allow. Let's take a look at these methods.
randomTimestamp
randomTimestamp as the name implies, generates a new random timestamp. This method was Timestamp
in the previous version.
randomTimestamp
randomDate
randomDate as the name implies, generates a new random date. This method is a new addition to the Date object.
getTimeZone
This method returns the current time zone of the user
now
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 setTimeZone
setTimeZone
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.
GetDateFromTimeStamp
This method gets the date in YYYY-MM-DD format from an existing timestamp
GetMonthFromNumber
This gets the month in words from a number (1-12)
GetDayFromNumber
This gets the day in words from a number (1-7)
GetEnglishDateFromTimeStamp
This gets the date in the format (MM DD, YYYY) from an existing timestamp
GetEnglishTimeStampFromTimeStamp
This gets the date in the format (DD MM, YYYY HH:MM:SS) from a timestamp
GetTimeFromTimeStamp
This gets the time in the format (HH:MM:SS) from a timestamp
Next Steps
Re-routing to index.phpSimple Routing
Request
Response