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

Posted by Bruno B B Magalhγes on 07/08/05 01:45

Hi Richard,

Well, I took a look at, and I think it is TOO complex to handler a
simple thing..

Well, that's my little contribution:

function str2time($input = '12/31/1969')
{
$year = substr($input, -4);

$input = substr_replace($input, 1976 , -4);

return floor(strtotime($input) + (($year - 1976) *
(31557376.189582)));
}

It work with ONLY a few hours more or less compared to my MacOS
strtotime function, now I don't know which one is more accurate..

Well, why did you choose the year 1976, because it's an bisixth(?)
year. So it was a matter of simple math.

I would appreciate any help from everybody to:

As I suppose that the last 4 digits are the year, I would like a
pattern that could match a four digits number inside a string.

Any body know how many seconds and microseconds have a year, I found
a round number (31557376.189582).

Well, any help is appreciate.

At least now I can work on a windows box.

Best Regards,
Bruno B B Magalhaes

On Jul 7, 2005, at 3:42 PM, Richard Davey wrote:

> Hello Bruno,
>
> Thursday, July 7, 2005, 7:04:44 PM, you wrote:
>
> BBBM> I've read the manual, and the ADOdb Date package functions, and
> BBBM> I am not using this because I want to keep my framework simple,
> BBBM> flexible, and fast.
>
> BBBM> Well, I just want a simple way to translate dates (I know what
> BBBM> is the input format) to unix timestamp, with ability to do this
> BBBM> with dates before 1970, and after 2023, is there any way?
>
> Personally I'd use the Pear Date package. It's stable, well formed and
> will do exactly what you require: http://pear.php.net/package/Date
>
> Even if you don't like the thought of using it - you can always pour
> over the source code to look at their methods and see how they handle
> it.
>
> Best regards,
>
> Richard Davey

 

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

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