kenny724 Posted February 2, 2012 Share Posted February 2, 2012 Anyone know why an empty date is showing up as 12/31/1969? Thanks. if(IsSet($approved_by) && $approved_by != "") { $sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $approved_by"; //echo "md_sig: $sql_query <br />"; $sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc"); $sql_array = mysql_fetch_array($sql_query_result); $md_sig = $sql_array[0]; //echo "sig: $md_sig <br />"; $md_name_string = "$sql_array[1] $sql_array[2]"; if(file_exists($md_sig)) { $md_sig = "<img src=\"$md_sig\" border=\"0\" alt=\"\" />"; } else { $md_sig = "<br /><br /><br />"; } //now clean up the date format $approved_date_string = strftime("%m/%d/%Y", strtotime($approved_date)); } else { $md_sig = "<br /><br /><br />"; $md_name_string = "Waiting for Approval"; $approved_date_string=""; } Quote Link to comment https://forums.phpfreaks.com/topic/256271-date-12311969/ Share on other sites More sharing options...
ManiacDan Posted February 2, 2012 Share Posted February 2, 2012 12/31/1969 is the date you get when you pass an invalid argument to date-processing functions. $approved_date doesn't exist in this code block. Perhaps it's set somewhere else? This is the perfect case for a basic debug lesson: You have a problem with your date. Your date function accepts one argument. Look at that argument. Figure out why it's wrong. Quote Link to comment https://forums.phpfreaks.com/topic/256271-date-12311969/#findComment-1313745 Share on other sites More sharing options...
kenny724 Posted February 2, 2012 Author Share Posted February 2, 2012 How can I find the invalid argument in all of this mess? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/256271-date-12311969/#findComment-1313756 Share on other sites More sharing options...
ManiacDan Posted February 2, 2012 Share Posted February 2, 2012 Do you not have any PHP experience? There's one line, by itself, that creates the date. It's even commented as to what it does. There's one variable used on that line, that's the one that's wrong. The variable that's wrong is not set in the block you pasted, so you'll have to figure it out on your own. Quote Link to comment https://forums.phpfreaks.com/topic/256271-date-12311969/#findComment-1313759 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.