<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1013270" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1013270</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/filtering-mysql-database-date-restriction#comment-1076994</link>
    <description> &lt;p&gt;the datetime thing came be avoided it you use the TIMESTAMP data type in the mySQL DB.&lt;/p&gt;
&lt;p&gt;Simply provide the user with dropdowns or whatever (as Maverick suggested).&lt;br /&gt;
Then, use the &lt;a href=&quot;http://php.net/manual/en/function.mktime.php&quot; class=&quot;bb-url&quot;&gt;mktime()&lt;/a&gt; function to create a timestamp to use in your queries.&lt;/p&gt;
&lt;p&gt;To put info into the DB, use the &lt;a href=&quot;http://php.net/manual/en/function.time.php&quot; class=&quot;bb-url&quot;&gt;time()&lt;/a&gt; function to insert a timestamp into your timestamp field.&lt;/p&gt;
&lt;p&gt;Good Luck,&lt;/p&gt;
 </description>
     <pubDate>Sun, 21 Jan 2001 22:45:24 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1076994 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/filtering-mysql-database-date-restriction#comment-1076991</link>
    <description> &lt;p&gt;Actually, you are probably going to need to manipulate things a bit with PHP. That SQL query is fine, but don&#039;t forget that MySQL will store a datetime field as &quot;2001-01-21 17:15:00&quot; for 5:15 pm January 21st, 2001 (the time I&#039;m writing this) and you need really really smart users to be able to enter their search queries in such a structured format. If they use a period instead of a colon, the query will fail. I&#039;m assuming that you&#039;ll want to make things a bit easier on them, I.E., allow them to choose month, date, time ranges, etc, from a series of drop down lists or radio buttons. If that&#039;s the case, you&#039;ll need a little PHP to combine the various pieces of the search string into a something that MySQL can understand. For example, assume you use separate variables for year, month, day, hours, minutes and seconds, you&#039;d need to combine them into a proper string like:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;$searchstring=&amp;quot;$year-$month-$day $hours:$minutes:$seconds&amp;quot;;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;then, you can use that $searchstring to query the database to assure that it&#039;s in a format that matches the datetime field.&lt;/p&gt;
 </description>
     <pubDate>Sun, 21 Jan 2001 22:20:35 +0000</pubDate>
 <dc:creator>Maverick</dc:creator>
 <guid isPermaLink="false">comment 1076991 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/filtering-mysql-database-date-restriction#comment-1076963</link>
    <description> &lt;p&gt;Wow I didn&#039;t think it would be THAT easy. I figured you&#039;re have to do some PHP work for that. MySQL is a great thing...&lt;/p&gt;
 </description>
     <pubDate>Sun, 21 Jan 2001 06:05:46 +0000</pubDate>
 <dc:creator>Gil</dc:creator>
 <guid isPermaLink="false">comment 1076963 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/filtering-mysql-database-date-restriction#comment-1076962</link>
    <description> &lt;p&gt;simple...&lt;/p&gt;
&lt;p&gt;in your query say:&lt;br /&gt;
&quot;WHERE field_name &amp;gt;= date_time AND field_name &amp;lt;= date_time&quot;&lt;/p&gt;
&lt;p&gt;As for user defined, just replace &quot;date_time&quot; with $user_time (or whatever you call the var)&lt;/p&gt;
&lt;p&gt;I recomend you use timestamps for ALL your date/time storage.  You can then pull any date/time info out of it that you wish.&lt;/p&gt;
 </description>
     <pubDate>Sun, 21 Jan 2001 05:59:19 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1076962 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
