Inserting dates with and without time depending on

Results 1 to 2 of 2

Thread: Inserting dates with and without time depending on

  1. #1
    Join Date
    Dec 1969

    Default Inserting dates with and without time depending on

    Hello! I would like to allow the user to insert dates into the db, in long format (2001-02-02 or 2001-02-02 12:30) . I use these forms: <BR>date_year<BR>date_month<BR>date_day<BR>time_ho ur<BR>time_minute<BR><BR>Now I have previously done something like this:<BR>------------------------<BR>date = DateSerial(Request("date_Year"), Request("date_Month"), Request("date_Day")) <BR>------------------------<BR>But I have only used that to add date without time (2001-02-02). Is it possible to sometimes have the time included, sometimes not, depending on whether the timeforms have been selected, and at the same time ensure that the date is inserted in proper form?<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Sure! And good coding...

    Nice job so far.<BR><BR>&#060;%<BR>theDate = DateSerial(Request("date_Year"), Request("date_Month"), Request("date_Day"))<BR><BR>If Request("time_hour") &#060;&#062; "" Then<BR> theTime = TimeSerial( Request("time_hour"), Request("time_minute"), 0 )<BR> theDate = theDate + theTime &#039; YES! Believe it or else!<BR>End If<BR>%&#062;<BR><BR>I should note that TimeSerial only accepts 24-hour clock format for hours. So 3PM must be given as 15, for the hour.<BR><BR> <BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts