Well,
I've read the manual, and the ADOdb Date package functions, and I am
not using this because I want to keep my framework simple, flexible,
and fast.
Well, I just want a simple way to translate dates (I know what is the
input format) to unix timestamp, with ability to do this with dates
before 1970, and after 2023, is there any way?
My current system the PHP's microtime it's Ok, but one of ours test
servers is running windows, and also some clients, so I rrealy need a
overall solution.
Here is my datetime class.
<?php
/
************************************************************************
***
* @name Date and Time Class (./framework/libraries/datetime.class.php)
* @version 1.0.0
* @dependencies None
************************************************************************
****
* @package B3M Platform™ 1.5.0
* @author B3M Development Team <development@xxxxxxxxxxx>
* @copyright 2004 by Bruno B B Magalhaes
* @copyright 2005 by B3M Development Team
* @link http://www.bbbm.com.br/platform/
************************************************************************
***/
class datetime
{
/
*********************************************************************
* Get microtime
*********************************************************************/
function timestamp($input = null)
{
if(is_null($input))
{
return (float)array_sum(explode(' ', (microtime() +
datetime::server_timezone_offset())));
}
else
{
return (float)array_sum(explode(' ', strtotime($input)));
}
}
/
*********************************************************************
* Format a microtime
*********************************************************************/
function format($timestamp = 0, $format = 'm/d/Y H:m:s')
{
return date($format, $timestamp);
}
/
*********************************************************************
* Get server's time-zone offset in seconds
*********************************************************************/
function server_timezone_offset()
{
if(!defined('_SERVER_TIMEZONE_OFFSET'))
{
return (float)date('Z');
}
else
{
return (float)_SERVER_TIMEZONE_OFFSET;
}
}
}
?>
Thanks everybody!
Best Regards,
Bruno B B Magalhaes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php