Jump to content

weird variable output


jimfog

Recommended Posts

Take a look at the code below:

$_REQUEST["month"] = date("n");$_REQUEST["year"]  = date("Y");$cMonth = $_REQUEST["month"];  $cYear  = $_REQUEST["year"];$timestamp = mktime(0, 0, 0, $cMonth, 1, $cYear);$thismonth = getdate($timestamp);$startday = $thismonth['wday'];

The strange with the above is that $startday outputs 0 to the browser while it should output 3-as it is Wednesday today. What do you think? Does the answer lie somewhere here:

$timestamp = mktime(0, 0, 0, $cMonth, 1, $cYear);

In the 1 appearing in the mktime function appearing above?

Link to comment
Share on other sites

$timestamp = mktime(0, 0, 0, $cMonth, 1, $cYear);1 is refering the day of this month. which is not today's date.http://php.net/mktime

Link to comment
Share on other sites

SO, it is referring to the first day of the month, correct?

Link to comment
Share on other sites

yes if you put todays day 25 will show you tthe correct one$timestamp = mktime(0, 0, 0, $cMonth, 25, $cYear);

Link to comment
Share on other sites

And sth else. About [wday] of getdate() function. Is Sunday denoted by 0-meaning the first of the week?Is that correct? Thanks again.

Link to comment
Share on other sites

Thank you very much. :good: I do not need sth else(for now).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...