tspatrick Posted September 12, 2007 Share Posted September 12, 2007 Hello, Can someone help me understand the following PHP. $startOfWeek = date("Y-m-d H:i:s",mktime(0,0,0,$_GET['month'],$_GET['day'],$_GET['year'])); $endOfWeek = date("Y-m-d H:i:s", strtotime($startOfWeek."+1 WEEK")); I am trying to convert this to ASP and need to at least know what the PHP script is trying to do. Thanks in advance. Shawn Quote Link to comment Share on other sites More sharing options...
micah1701 Posted September 12, 2007 Share Posted September 12, 2007 see http://www.php.net/date , http://www.php.net/mktime and http://www.php.net/strtotime date is a function. the first half of the function says how to format the result. In this case it will look like "YYYY-MM-DD Hour:minute:seconds" the second half of the date() function - after the comma - is the exact date/time (given in a 10-digit integer known as unix time -- the number of seconds since its inception in 1970) in each line of code you've given, there is a different way to come oup with this unixtime date/time value the first, mktime, uses the comma seperated lists of "Hour, Minute, Second, Month, Day, Year" -- in this case, its talking about midnight on the specific date passed through the URL. (when this page loads, the URL must end with something like: ?month=04&day=07&year=1979 in the second line, strtotime, is a function that creates the 10-digit unix time number based on almost any formated date you enter into it. In this case, its adding 1 week to the date given in the URL. hope that helps. but why not just use PHP? its kicks ASP and .NET's BUTT!!! Quote Link to comment Share on other sites More sharing options...
tspatrick Posted September 13, 2007 Author Share Posted September 13, 2007 Ok, Sorry for the long delay for my reply. So if I am understanding corretly the variable $startOfWeek should equal something like ... $startOfWeek = 2007-9-12 22:50:00,tendigitunixtime $endOfWeek = 2007-9-12 22:50:00,$startOfWeektendigitunixtime+oneweek If that makes sense. Of course, i understand there will be a digit unix time and not the characters just trying to get an understanding so I can convert it to ASP. Yes, you are right I should just do it in PHP. Matter of fact this script is already done in PHP but the rest of the application is in ASP. I have no excuses just creature of habit. I have been programming in ASP/VBSCRIPT for a very long time and do not have enough time to stop to learn anything different. I have been adding new languages along the way but not able to just switch cold turkey. After your post and the links you provided, PHP seems to be very straight forward and possibly easy to learn. Thanks, Shawn Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.