I have made a script that gets only friday and puts them in a drop down but now i dont want to upload it into the datbase as a string i need it as timestamp so i can filter and order for current day and such.

here is the form

<?php
echo "<form action='".$_SERVER['php_self']."' method='post'> ";
print "<select name=\"start\" size=\"1\">"; 
print "<option value=\"Select Week\" selected>Select Week</option>"; 
for($i=0; $i<=6; $i++){ 
$num = date("d M Y", strtotime('next friday +'.$i.' week')); 
print"<option value=\"{$num}\">{$num}</option> \n"; 
} 
print "</select>";
echo "<input name='Submit' type='submit' id='start' value='Send Day'>";
echo "</form>";

and here is the upload to database part

$fridate = $_POST['start'];
$create = "INSERT INTO day (day) VALUES ('$fridate')";
$query=mysql_query($create);
if (!$query)
  echo $create."<br />makes an error:<br />".mysql_error();
?>

can anyone please help me to get the timestamp for the day so i can save into the database as date and not string?

I have tried all the ways and havent been able to figure it out can you please help some more and show me(im kinda thick)?

Try this out, prior to insert query:

$fridate=date('Y-m-d h:i:s',strtotime($fridate));

Amazing. It works. Thank you very much. I got close

$fridate2 = date('d F Y', strtotime('$fridate'));

You good man.

This site is amazing. The best

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.