Пример #1
0
/**
 * Returns the age (in years)
 * Does not take into account timezone offset differences
 *
 * @param $sql_time sql timestamp representing day of birth
 * @return number of years old
 */
function age($ts)
{
    return num_years($ts, time());
}
Пример #2
0
if (parse_duration('-4h') != -14400) {
    echo "FAIL 61\n";
}
if (num_days('2010-03-04', '2010-03-04') != 1) {
    echo "FAIL 70\n";
}
if (num_days('2010-03-04', '2010-03-06') != 3) {
    echo "FAIL 71\n";
}
if (num_days('2010-01-01', '2010-02-24') != 55) {
    echo "FAIL 72\n";
}
if (num_days('2010-03-01', '2010-03-31') != 31) {
    echo "FAIL 73\n";
}
if (num_years('1980-05-26', '1990-02-12') != 9) {
    echo "FAIL 74\n";
}
if (ts(0) != 0) {
    echo "FAIL 80\n";
}
if (ts('') != 0) {
    echo "FAIL 81\n";
}
if (!is_ymd('2011-12-31')) {
    echo "FAIL 90\n";
}
if (is_ymd('2011-12-32')) {
    echo "FAIL 91\n";
}
if (is_ymd('2011-13-01')) {