Jump to content

[SOLVED] adding date and time together


runnerjp

Recommended Posts

ok i have got my form to enter tiem and date of a race

<form name="f" method="POST">
  <table cellpadding="0" cellspacing="0" border="0" bgcolor="#000000"><tr><td>
    <table cellpadding="4" cellspacing="1" border="0 "bgcolor="#FFFFFF">
      <tr><td colspan="2" bgcolor="#000000"><font size="+1" color="#FFFFFF"><b>Add New Event</b></font></td></tr>
      <tr><td><b>Event Start Date: </b></td><td><input type="text" name="eventdate" value="" size="12"> <font size="2">mm/dd/yyyy</font></td></tr>
          <tr><td><b>Event Start: </b></td><td><input name="start" size="6"/><font size="2">00:00</font></td></tr>
          <tr><td><b>Event finish Date: </b></td><td><input type="text" name="eventdate" value="" size="12"> <font size="2">mm/dd/yyyy</font></td></tr>
          <tr><td><b>Event Finish: </b></td><td><input name="finish" size="6" /><font size="2">00:00</font></td></tr>
          <tr><td><b>Event:</b></td><td><input type="text" name="event" size="35" maxlength="128"></td></tr>
      <tr><td colspan="2" align="center" bgcolor="#CCCCCC"><input type="button" name="Submit" value="OK" onClick="javascript: formget2(this.form, 'http://www.runningprofiles.com/members/calendar/addevent.php');"> </td></tr>
        </table></td></tr></table></form>

 

how can i add both the dates and time together using strtotime() ??

 

so then i can call from my db like this

 

$iso_8601_date_time_string = date('Y-m-d', strtotime("April 17, 2009"));

$sql = "SELECT e_id FROM events WHERE '$iso_8601_date_time_string' BETWEEN e_start AND e_end";

 

Link to comment
Share on other sites

SELECT column_name(s)

FROM table_name

WHERE column_name

BETWEEN value1 AND value2

 

$iso_date isnt a column

and e_start and e_end arent values

 

u got them mixed up

 

My guess is u wud use

WHERE e_start >= $iso_date AND e_end <= $iso_date

 

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.