Jump to content

Date from $_GET


ebolt007

Recommended Posts

Ok, I have a form with a field that is a datre currently set to use the follwing date;

$main_date = date("l, F j, Y", $cur_date_timestamp);

and my input area is as follows.

echo "<form action=\"mobile_index.php\" enctype=\"multipart/form-data\" method=\"get\" name=\"update_form\">\n";
echo "<input type='text' size=\"26\" name='date' class=\"mobile_input\" value='$main_date' onKeyPress=\"return submitenter(this,event)\">\n";
echo "</form>\n";

Now when this submits I get mobile_index.php?date=Monday%2C+October+17%2C+2012 in my url

 

I need to get that date tho and use it as a variable so I can break it apart into 3 parts like.

$main_date2 = $_GET['date'];
                $main_date = date("M-d-Y", $main_date2);
              	$cur_day = date("d", $main_date);
              	$cur_month = date("n", $main_date);
              	$cur_year = date("Y", $main_date);

 

Is there anyway to do this? I get Warning: date() expects parameter 2 to be long, string given in /home/admin/public_html/mobile_index.php on line 15 Because the date isn't an integer variable PHP understands, because line 15 is $main_date = date("M-d-Y", $main_date2); How do I break the $main_date2 into yeear, month and day so I can work with it?

 

Thanks

 

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.