Re: Another simple question (Probably)

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

 



On 7/9/07, Shafiq Rehman <rehmanms@xxxxxxxxx> wrote:
Hi,

correct syntax for mktime is mktime( int hour, int minute, int second,  int
month, int day, int year)

--
Shafiq Rehman (ZCE)
http://www.phpgurru.com | http://shafiq.pk
Cell: +92 300 423 9385

On 7/9/07, Jason Pruim <japruim@xxxxxxxxxx> wrote:
>
> Okay so given this section of code:
>
> $taskTime=mktime(00,00,00,$_POST['txtReschedule']);
>
> echo <<<HTML
>
> <tr>
>         <td bgcolor="{$rowColor}">ID#, {$row['id']} </td>
>         <td bgcolor="{$rowColor}">TicklerName, {$row['task_name']}  </td>
>         <td bgcolor="{$rowColor}">Instructions, <a href='{$row
> ['task_desc']}'>Instructions</a></td>
>         <td bgcolor="{$dowColor}">DayOfWeekWord, {$dowword} </td>
>         <td bgcolor="{$rowColor}">DateToReschedule, <input type='text'
> name='tasks[{$row['id']}][txtReschedule]' value=''></td>
>         <td bgcolor="{$rowColor}">DateRescheduled, {$Date}</td>
>         <td bgcolor="{$rowColor}"><a href='update.php?taskid={$row['id']}
> &taskdate={$taskdate}'>Click here!</a></td>
>         <td bgcolor="{$rowColor}">CheckboxForWhenDone,
>                 <input  type='checkbox'
> name='tasks[{$row['id']}][chkDone]'
> value='{$row['id']}'></td>
> </tr>
>
> HTML;
>
> Why am I getting a time stamp of:
>
> 1165640400
> Sat, Dec-09-06?
>
> I have been fighting with trying to figure this out and finally
> decided to show my ignorance of the language and ask for help :)
> Besides, the boss wants this done :)
>
> Jason
> <?PHP
>
>         if($brain =="Monday"){
>                 echo "Let me go home!"
>         };
>
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


   That's correct, but not all are explicitly required.  The function
should actually be written as follows:

   int mktime( [int hour [,int minute [,int second [,int month [,int
day [,int year [,int dst]]]]]]] )

   And by default, if date() is given a second parameter, but that
parameter is null or empty, date() will return `9 December, 2006`
(formatted accordingly).  I'm not certain of the significance of this,
nor am I sure that all versions of PHP will return this same value.
I'd have expected Unix epoch time, so 9 December, 2006, could be an
easter egg date.  Worth reading up on, but nothing I can find so far
explains it.  ANYONE ELSE KNOW?  I'd love to find out!

   Another thing to note is that, if date() is passed information it
doesn't understand in the second parameter, it will return `31 August,
2000` at midnight.  Once again, not sure why, but I'd love to hear the
reason if anyone else knows.

   Some other things to note:

   1.) While it's a Good Idea[tm] to follow the input structure for
mktime() as I listed above, it's actually not required for some dates
and formats.  However, I wasn't able to narrow-down a good algorithm
to prove it, so you should split() or explode() your date when it's
received.

   2.) HOWEVER.... when passing this information to date(), you have
to keep in mind that leading zeros may be interpreted as octal values
by date() itself.  If you keep getting a SNAFU result, try using a
different date() flag to represent the month or day.

   3.) Sometimes I don't make much sense.... considering that it's
Monday morning, this may be one of those times.

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--
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