You are here: Re: trouble making a date « PHP Programming Language « IT news, forums, messages
Re: trouble making a date

Posted by Kimmo Laine on 11/27/06 08:21

<drtebi@gmail.com> wrote in message
news:1164599656.224112.279450@f16g2000cwb.googlegroups.com...
> On Nov 26, 7:52 pm, l...@portcommodore.com wrote:
>> laredotorn...@zipmail.com wrote:
>> > Hi,
>>
>> > Using PHP 4.4.4 and I'm getting an odd time stamp attempting to make a
>> > php date. Here's the code
>>
>> > $reqDate = date("Y-m-d", mktime(0, 0, 0, $y, $m, $d));
>> > $reqDateTS = strtotime($reqDate);

>
> The problem is very simple. You have the parameter order wrong for
> mktime. It should be this:
>
> $reqDate = date("Y-m-d", mktime(0, 0, 0, $m, $d, $y));

I don't get the double conversion... mktime already returns a unix
timestamp, so why pass the timestamp to date and then give the date again to
strtotime to make yet another timestamp, which is the exact same that mktime
returned... Simplify!

$reqDateTS = mktime(0, 0, 0, $d, $m, $y);

Remember KISS and LOVE:
Keep It Simple, Stupid. Leave Out Virtually Everything.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

 

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

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