-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
The hardest part of handling dates is coping with different time zones and formats. Luckily, Joomla! provides us with the JDate class to handle date formatting. Before we start using the JDate class we need to import the relevant library:
jimport('joomla.utilities.date');A JDate object is designed to handle a single date. This means that we must create a new JDate object for every date. When we create a new JDate object, in its most basic form, the object automatically obtains the current date and time. We can create a new JDate object for the current date and time as follows:
$dateNow = new JDate();
When we create a new JDate object we can pass two optional parameters:
the date and time, which the object will parse
the time zone
The first parameter can be passed using a number of different formats. Supported date and time formats include Unix timestamps, RFC 2822, ISO 8601, and any format that the PHP strtotime()
function is capable of parsing.
For more information...
Change the font size
Change margin width
Change background colour