<div>Thanks Carl. This worked for me with schema as datetime.</div>
<div> </div>
<div>Schema used as &quot;  &#39;dob&#39; =&gt; array(&#39;type&#39; =&gt; &#39;datetime&#39;, &#39;length&#39; =&gt; 19, &#39;default&#39; =&gt; &#39;0000-00-00 00:00:00&#39;),   &quot; </div>
<div> </div>
<div>If I use schema as date,  when I reinstall module, I get error.</div>
<div> </div>
<div>Schema used as &quot; &#39;dob&#39; =&gt; array(&#39;type&#39; =&gt; &#39;date&#39;, &#39;length&#39; =&gt; 19, &#39;default&#39; =&gt; &#39;0000-00-00&#39;), &quot;</div>
<div> </div>
<div>Am I doing anything wrong with Schema declaration?. </div>
<div> </div>
<div>Error</div>
<div>-------------</div>
<div><em><font color="#ff0000">user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#39;DEFAULT &#39;0000-00-00&#39;, `yrsofexp` INT unsigned NOT NULL DEFAULT 0, `prefworkloc&#39; at line 9 query: CREATE TABLE resubmt_table ( `uid` INT unsigned NOT NULL DEFAULT 0, `name` VARCHAR(64) NOT NULL DEFAULT &#39;&#39;, `qualification` VARCHAR(64) NOT NULL DEFAULT &#39;&#39;, `email` VARCHAR(64) NOT NULL DEFAULT &#39;&#39;, `altemail` VARCHAR(64) NOT NULL DEFAULT &#39;&#39;, `phone` VARCHAR(15) NOT NULL DEFAULT &#39;&#39;, `altphone` VARCHAR(15) NOT NULL DEFAULT &#39;&#39;, `dob` DEFAULT &#39;0000-00-00&#39;, `yrsofexp` INT unsigned NOT NULL DEFAULT 0, `prefworkloc` VARCHAR(64) NOT NULL DEFAULT &#39;&#39;, INDEX name (name), INDEX yrsofexp (yrsofexp), INDEX prefworkloc (prefworkloc) ) /*!40100 DEFAULT CHARACTER SET utf8 */ in C:\MyWeb6.20\wamp\www\livejobs1\includes\database.inc on line 551.</font></em></div>

<div> </div>
<div> </div>
<div>As such there is no reason for not using Date, Content-profile. I do not know what content-profile does .., I will make use of Date.</div>
<div><br>Regards</div>
<div>Austin.<br></div>
<div class="gmail_quote">On Tue, Mar 29, 2011 at 10:40 AM, Carl Wiedemann <span dir="ltr">&lt;<a href="mailto:carl.wiedemann@gmail.com">carl.wiedemann@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">I assume you&#39;re using Drupal 6. See the date_api.module functions like date_make_date() which will return a Date object that can be formatted with date_format_date(). 
<div><br></div>
<div>Your schema type should be DATETIME or DATE <a href="http://dev.mysql.com/doc/refman/5.0/en/datetime.html" target="_blank">http://dev.mysql.com/doc/refman/5.0/en/datetime.html</a> </div>
<div><br></div>
<div>You probably want to have something like this to INSERT/UPDATE the db.</div>
<div><br></div>
<div>$date_array[&#39;year&#39;] . &#39;-&#39; . $date_array[&#39;month&#39;] . &#39;-&#39; . $date_array[&#39;day&#39;] . &#39; 00:00:00&#39;;</div>
<div><br></div>
<div>Then, when you SELECT the value you can do something like this.</div>
<div><br></div>
<div>$displayed_date = date_format_date(date_make_date($value, &#39;UTC&#39;), &#39;custom&#39;, &#39;m/d/Y&#39;);</div>
<div>
<div><br></div>
<div>
<div>Non-language specific strings do not need to be handled with t(), too. :)</div></div>
<div><br></div>
<div>Also, is there a reason you&#39;re not using Content Profile with Date module to accomplish your task?</div>
<div><a href="http://drupal.org/project/content_profile" target="_blank">http://drupal.org/project/content_profile</a></div>
<div><a href="http://drupal.org/project/date" target="_blank">http://drupal.org/project/date</a></div>
<div><br></div>
<div><br>
<div class="gmail_quote">
<div>
<div></div>
<div class="h5">On Mon, Mar 28, 2011 at 10:49 PM, Austin Einter <span dir="ltr">&lt;<a href="mailto:austin.einter@gmail.com" target="_blank">austin.einter@gmail.com</a>&gt;</span> wrote:<br></div></div>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>
<div></div>
<div class="h5">
<div>After all search, I found it really difficult to deal with date. I am trying to store the date in MySql table as varchar type and placeholder as %s.</div>
<div> </div>
<div>However I need two functions to convert date from array format to string format (required while storing into table) and string format to array format (Required while showing it in form).</div>
<div> </div>
<div>The below code does that for me.</div>
<div> </div>
<div> </div>
<div><strong><em>function dateArrToStr(&amp;$customDateArr)<br>{<br> $strDate = t($customDateArr[&#39;day&#39;]).t(&#39;- &#39;).t($customDateArr[&#39;month&#39;]).t(&#39;-&#39;) . t($customDateArr[&#39;year&#39;]);<br> return $strDate;<br>
}</em></strong></div>
<div><strong><em></em></strong> </div>
<div><strong><em></em></strong> </div>
<div><strong><em>function dateStrToArr (&amp;$customDateStr, $length)<br>{<br>    $convDate = array();<br> $index = 0;<br> $customToken = t(&#39;&#39;);<br> $dashPosition = 0;<br> <br> for($index = 0; $index &lt; $length; $index++)<br>
 {<br>  if($customDateStr[$index] == t(&#39;-&#39;))<br>  {<br>   if($dashPosition == 0)<br>   {<br>    //Set the day<br>    $dashPosition++;<br>       $convDate[&#39;day&#39;] =  $customToken;<br>   }<br>   else if ($dashPosition == 1)<br>
   {<br>    //Set the month<br>    $dashPosition++;<br>    $convDate[&#39;month&#39;] = $customToken;<br>   }<br>   $customToken = t(&#39;&#39;);<br>  }<br>  else<br>  {<br>   $customToken = t($customToken) . t($customDateStr[$index]) ;<br>
  }<br> }<br> //Set year<br> $convDate[&#39;year&#39;] = $customToken;<br> return $convDate;<br>}</em></strong></div>
<div>
<div></div>
<div>
<div> </div>
<div> </div>
<div>Regards</div>
<div>Austin<br><br></div>
<div class="gmail_quote">On Mon, Mar 28, 2011 at 8:36 AM, Austin Einter <span dir="ltr">&lt;<a href="mailto:austin.einter@gmail.com" target="_blank">austin.einter@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div>Hi All</div>
<div>I have a date field in my form.</div>
<div>How do I store/retreive the value into/from MySQL.</div>
<div> </div>
<div>On google search, I saw people are suggesting to use either &quot;int&quot; or &quot;datetime&quot; type.</div>
<div>Please suggest which one needs to be used.</div>
<div> </div>
<div>If I use int (I hope core uses int), while storing can I just store &quot;form[&#39;values&#39;][&#39;date1&#39;]&quot; as %d and while retreivin, what are the related apis to convert back to date.</div>
<div> </div>
<div>Regards</div>
<div>Austin.</div><font color="#888888">
<div> </div>
<div> </div></font></blockquote></div><br></div></div><br></div></div>
<div class="im">--<br>[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></div></blockquote></div><br></div></div><br>--<br>[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</blockquote></div><br>