Forum Moderators: coopster

Message Too Old, No Replies

strototime and $ POST

         

tonynoriega

5:34 pm on Nov 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a page on my site that im in the process of developing. It is a reporting application where my agents can select two dates from a javascript popup calendar.

They create two variables:

$date1 = $_POST['date1']; //yyyy-MM-dd format
$date2 = $_POST['date2']; //yyyy-MM-dd format

What i want to do is create another variable called:

$end_date

and change it to only show the day of the week...
I am trying to use strotime but cant seem to get it to work...

here is what i had :

$end_date = date("l", strototime($_POST['date2']));

I have then read a few posts that state i need to convert the variable $date2 to a timestamp first, then convert it and format it with strotime...

anyone?

d40sithui

7:03 pm on Nov 1, 2007 (gmt 0)

10+ Year Member



have u tried using mktime?

<?
$end_date = $_POST['date2'];
echo date("D", mktime(0, 0, 0, substr($end_date, 5,2), substr($end_date,8,2), substr($end_date,0,4));
?>

tonynoriega

10:10 pm on Nov 1, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i figured it out.

thank you.

$date1 = $_POST['date1'];
$date2 = $_POST['date2'];
$new_date2 = strtotime("$date2");
$end_date = date("l", $new_date2);