| // +----------------------------------------------------------------------+ // // $Id$ // require_once 'Date.php'; require_once 'Date/Span.php'; $date = new Date(); $tmp = new Date($date); printf("Actual date: %s\n", $date->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('0:00:00:05')); printf("Subtracting 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('0:00:20:00')); printf("Subtracting 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('0:10:00:00')); printf("Subtracting 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('3:00:00:00')); printf("Subtracting 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->subtractSpan(new Date_Span('3:10:20:05')); printf("Subtracting 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('0:00:00:05')); printf("Adding 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('0:00:20:00')); printf("Adding 20 minutes: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('0:10:00:00')); printf("Adding 10 hours: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('3:00:00:00')); printf("Adding 3 days: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); $tmp->copy($date); $tmp->addSpan(new Date_Span('3:10:20:05')); printf("Adding 3 days, 10 hours, 20 minutes and 5 seconds: %s\n", $tmp->getDate(DATE_FORMAT_ISO)); ?>