Jump to content

Date 12/31/1969??


kenny724

Recommended Posts

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="";

}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.