You are here: TimeStamp BEFORE 1970 « PHP « IT news, forums, messages
TimeStamp BEFORE 1970

Posted by Bruno B B Magalhγes on 07/07/05 21:04

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@bbbm.com.br>
* @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

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация