old mode 100755
new mode 100644
| | |
| | | // +----------------------------------------------------------------------+ |
| | | // | PHP versions 4 and 5 | |
| | | // +----------------------------------------------------------------------+ |
| | | // | Copyright (c) 1998-2004 Manuel Lemos, Tomas V.V.Cox, | |
| | | // | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, | |
| | | // | Stig. S. Bakken, Lukas Smith | |
| | | // | All rights reserved. | |
| | | // +----------------------------------------------------------------------+ |
| | |
| | | // | Author: Lukas Smith <smith@pooteeweet.org> | |
| | | // +----------------------------------------------------------------------+ |
| | | // |
| | | // $Id$ |
| | | // $Id: Date.php,v 1.10 2006/03/01 12:15:32 lsmith Exp $ |
| | | // |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * Several methods to convert the MDB2 native timestamp format (ISO based) |
| | | * to and from data structures that are convienient to worth with in side of php. |
| | | * to and from data structures that are convenient to worth with in side of php. |
| | | * For more complex date arithmetic please take a look at the Date package in PEAR |
| | | * |
| | | * @package MDB2 |
| | |
| | | { |
| | | return date('Y-m-d H:i:s'); |
| | | } |
| | | |
| | | // }}} |
| | | |
| | | // {{{ mdbToday() |
| | | |
| | | /** |
| | |
| | | { |
| | | return date('Y-m-d'); |
| | | } |
| | | |
| | | // }}} |
| | | |
| | | // {{{ mdbTime() |
| | | |
| | | /** |
| | |
| | | { |
| | | return date('H:i:s'); |
| | | } |
| | | |
| | | // }}} |
| | | |
| | | // {{{ date2Mdbstamp() |
| | | |
| | | /** |
| | | * convert a date into a MDB2 timestamp |
| | | * |
| | | * @param integer $hour hour of the date |
| | | * @param integer $minute minute of the date |
| | | * @param integer $second second of the date |
| | | * @param integer $month month of the date |
| | | * @param integer $day day of the date |
| | | * @param integer $year year of the date |
| | | * @param int hour of the date |
| | | * @param int minute of the date |
| | | * @param int second of the date |
| | | * @param int month of the date |
| | | * @param int day of the date |
| | | * @param int year of the date |
| | | * |
| | | * @return string a valid MDB2 timestamp |
| | | * @access public |
| | | */ |
| | |
| | | { |
| | | return MDB2_Date::unix2Mdbstamp(mktime($hour, $minute, $second, $month, $day, $year, -1)); |
| | | } |
| | | |
| | | // }}} |
| | | |
| | | // {{{ unix2Mdbstamp() |
| | | |
| | | /** |
| | | * convert a unix timestamp into a MDB2 timestamp |
| | | * |
| | | * @param integer $unix_timestamp a valid unix timestamp |
| | | * @param int a valid unix timestamp |
| | | * |
| | | * @return string a valid MDB2 timestamp |
| | | * @access public |
| | | */ |
| | |
| | | { |
| | | return date('Y-m-d H:i:s', $unix_timestamp); |
| | | } |
| | | |
| | | // }}} |
| | | |
| | | // {{{ mdbstamp2Unix() |
| | | |
| | | /** |
| | | * convert a MDB2 timestamp into a unix timestamp |
| | | * |
| | | * @param integer $mdb_timestamp a valid MDB2 timestamp |
| | | * @param int a valid MDB2 timestamp |
| | | * @return string unix timestamp with the time stored in the MDB2 format |
| | | * |
| | | * @access public |
| | | */ |
| | | function mdbstamp2Unix($mdb_timestamp) |
| | |
| | | $arr = MDB2_Date::mdbstamp2Date($mdb_timestamp); |
| | | |
| | | return mktime($arr['hour'], $arr['minute'], $arr['second'], $arr['month'], $arr['day'], $arr['year'], -1); |
| | | } |
| | | |
| | | } |
| | | // }}} |
| | | |
| | | // {{{ mdbstamp2Date() |
| | | |
| | | /** |
| | | * convert a MDB2 timestamp into an array containing all |
| | | * values necessary to pass to php's date() function |
| | | * |
| | | * @param integer $mdb_timestamp a valid MDB2 timestamp |
| | | * @param int a valid MDB2 timestamp |
| | | * |
| | | * @return array with the time split |
| | | * @access public |
| | | */ |
| | |
| | | sscanf($mdb_timestamp, "%04u-%02u-%02u %02u:%02u:%02u"); |
| | | return $arr; |
| | | } |
| | | |
| | | // }}} |
| | | } |
| | | |