In this chapter, we investigate how we can use and extend the
Joomla! tree data structure.
Logging events can be a very useful function. We discuss the use of the JLog class to
create log files and append log entries to log files.
This list names the classes discussed in this chapter:
JArchive
JArrayHelper
JDate
JFile
JFolder
??? ??? ??? ??? ???
Utilities and Useful Classes
[ 340 ]
JLog
JMail
JNode
JPath
JTree
Dates
The hardest part of handling dates is coping with different time zones and formats.
Luckily, Joomla! provides us with the JDate class that handles 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 attempts to determine the current date and time.
This example demonstrates how we create a new JDate object for the current date
and time:
$dateNow = new JDate();
When we create a new JDate object we can pass two optional parameters:
Date and time, which the object will parse
Time zone
The first parameter can be passed in a number of different formats.
Pages:
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471