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

Posted by Curtis on 11/27/06 10:46

Exactly! Kimmo Laine makes a good point

However, the correct argument order for mktime is the following (from
php.net manual):
int mktime ( [int hour [, int minute [, int second [, int month [,
int day [, int year [, int is_dst]]]]]]] )

So, the mktime argument order should be:
$timestamp = mktime(0, 0, 0, $m, $d, $y);

Curtis

On Nov 27, 12:21 am, "Kimmo Laine" <s...@outolempi.net> wrote:
> <drt...@gmail.com> wrote in messagenews: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" - lpkhttp://outolempi.net/ahdistus/- Satunnaisesti päivittyvä nettisarjis
> s...@outolempi.net | rot13(x...@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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация