' . $ps_date . "
\n"; } $date = new Date(); ?>

Object is set to currrent time and local time zone by default:

format('%d/%m/%Y %H.%M.%S%O (%Z)')); echo_code($date->format2('DD/MM/YYYY HH.MI.SSTZO (TZC - TZN)')); echo_code($date->getDate(DATE_FORMAT_ISO)); ?>

Set date to 1st February, 1991:

setDate("1991-02-01 01:02:03"); echo_code($date->format('%d/%m/%Y %H.%M.%S')); echo_code($date->format2('DD/MM/YYYY HH.MI.SS')); // Display day, month spelled out: // echo_code($date->format('%A, %e %B %Y, %H.%M.%S')); echo_code($date->format2('NPDay, NPDDth Month YYYY, HH.MI.SS')); ?>

Time without padding (i.e. leading noughts), and with short year:

format('%e/%m/%y %h.%M.%S')); echo_code($date->format2('NPDD/NPMM/YY NPHH.MI.SS')); ?>

Conversion to another time zone:

convertTZbyID("Asia/Calcutta"); echo_code($date->format2('"Time zone ID:" TZR')); echo_code($date->format2('"Time zone name:" TZN')); echo_code($date->format2('"Time zone code:" TZC')); echo_code($date->format2('"Time zone offset:" TZO')); echo "
\n"; echo_code($date->format2('DD/MM/YYYY HH.MI.SSTZO (TZC)')); ?>

Addition/Subtraction:

addDays(-1); echo_code($date->format2('DD/MM/YYYY HH.MI.SS')); $date->addHours(13); echo_code($date->format2('DD/MM/YYYY HH.MI.SS')); ?>

12-hour time:

format('%d/%m/%Y %I.%M.%S %p')); echo_code($date->format2('DD/MM/YYYY HH12.MI.SS am')); ?>

Display micro-time:

setSecond(3.201282); echo_code($date->format('%d/%m/%Y %I.%M.%s')); echo_code($date->format2('DD/MM/YYYY HH12.MI.SS.FFFFFF')); ?>

Convert to Unix time:

format2('U')); ?>

Convert Unix time back to Date object:

format2("DD/MM/YYYY HH.MI.SSTZO")); ?>

Compare two times for equality:

before($date)) { echo "second date is earlier (because Unix time ignores the part-second)
\n"; } $date->trunc(DATE_PRECISION_SECOND); if ($date2->equals($date)) { echo "dates are now the same
\n"; } ?>