Re: How should I ....--its a date/timestamp issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Paul M Foster" <paulf@xxxxxxxxxxxxxxxxx> wrote in message 
news:20090219022913.GL18160@xxxxxxxxxxxxxxxxxxxx
> On Wed, Feb 18, 2009 at 05:25:16PM -0600, Terion Miller wrote:
>
> <snip>
>
>>      What about just accepting any date in to the system, and defaulting 
>> to
>>      the current date if any numptys/users try to set one before?
>>
>>      Do something maybe like this (untested)
>>
>>      $userDate = strtotime($_REQUEST['date']);
>>      $startDate = ($userDate < time())?time():$userDate;
>>
>>      >From there, you can use the timestamp how you wish.
>>
>>      OOH found it:
>>      $startday  = mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"));
>>
>>      Well no, guess I didn't find it because that code above gives me
>>      this 1235109600
>>
>>      What is that??
>
> It's a *nix timestamp number. Give it to date() this way:
>
> date('Y-m-d', $startday)
>
> And you'll see the date it represents. (It's actually the number of
> seconds since, the Unix epoch, in 1970.)
>
> Paul
>
> -- 
> Paul M. Foster

Sorry been gone a while.
I usually double validate.  Once in javascript to make sure the date is 
valid before submit, and then again in php incase some maroon screws around 
and/or has javascript disabled on their system.  Hope that helps even if it 
is a bit late. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux