mash Posted November 9, 2007 Share Posted November 9, 2007 I'm working on editing a calendar program. It is a simple equipment check out calendar; the user selects the item and check out/in date and time to add a reservation. When I add a reservation on an item, I'm getting this error message: Warning: mktime() [function.mktime]: Windows does not support negative values for this function in D:\aedecon\intranet\resources\resource_update.php on line 91 1198015200 1230760800 However, it does work and the reservation is added to the calendar. Here is the code for the section where the problem is: //********************************************* // GET info from Form and URL //******************************************** $check_out = $_GET[check_out]; $check_out_time= $_GET[time]; $max_out = $_GET[max_out]; $max_time = $_GET[max_time]; $name = $_GET[nid]; $check_in_month = $_POST[inmonth]; $check_in_day = $_POST[inday]; $check_in_year = $_POST[inyear]; $check_in_time = $_POST[intime]; $check_in_date = "$check_in_year-$check_in_month-$check_in_day"; $who = $_POST[who]; $why = $_POST[why]; $check_in_as_date = mktime($check_in_time,0,0,$check_in_month,$check_in_day,$check_in_year); $max_out_as_date = mktime($max_time,0,0,substr($max_out,5,2),substr($max_out,8,2),substr($max_out,0,4)); $check_out_as_date = mktime(substr($check_out_time,0,2),0,0,substr($check_out,5,2),substr($check_out,8,2) ,substr($check_out,0,4)); The problem area, line 91, is this part: $max_out_as_date = mktime($max_time,0,0,substr($max_out,5,2),substr($max_out,8,2),substr($max_out,0,4)); Link to comment https://forums.phpfreaks.com/topic/76665-mktime-help-negative-value/ Share on other sites More sharing options...
Barand Posted November 9, 2007 Share Posted November 9, 2007 What does echo $max_out; give? Link to comment https://forums.phpfreaks.com/topic/76665-mktime-help-negative-value/#findComment-388167 Share on other sites More sharing options...
pocobueno1388 Posted November 9, 2007 Share Posted November 9, 2007 Barand, just to let you know, there has been multiple double posts today. Someone earlier said they got an error and it posted the topic twice, so I don't think the posters are intentionally doing it. Link to comment https://forums.phpfreaks.com/topic/76665-mktime-help-negative-value/#findComment-388173 Share on other sites More sharing options...
Barand Posted November 9, 2007 Share Posted November 9, 2007 OK. I won't ban him Link to comment https://forums.phpfreaks.com/topic/76665-mktime-help-negative-value/#findComment-388175 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.