Page 1 of 2 12 LastLast
Results 1 to 10 of 11


  1. #1
    harshil Guest


    Hi all<BR><BR>I have a great difficulty dealing with dates.<BR>Now, I have a table with a date field. (datatype :datetime)<BR>When i retreive any record from an asp page, i get the full date. Eg : 01/01/2001 2:50:00 AM<BR><BR>Now the problem is that i only require the DATE part<BR>(ie. 01/01/2001) and not the TIME.<BR><BR>Is it possible through any SQL statement or any ASP function to only retreive the DATE and not the time.<BR><BR>Plz reply ASAP.<BR><BR>Thankx !!!

  2. #2
    Eddie Campbell Guest

    Default Use The DatePart Function


  3. #3
    Al Bear Guest


    What you are using I think is <BR><BR>now() <BR><BR>if you use <BR><BR>now(date) this will give you the date with no time.

  4. #4
    Mike Shaffer Guest

    Default Umm... no. :-)

    Both of the solutions presented are incorrect.<BR><BR>Datepart() won&#039;t work as advertised. You need to include a specific part of the date (the month, the day, etc) that you want. And NOW(datevalue) is incorrect syntax.<BR><BR>Use the DATEVALUE() and TIMEVALUE() to retrieve the date and time value portions of a date type variable.

  5. #5
    Al Bear Guest

    Default Whoops

    should be <BR><BR>response.write (date)<BR>var = (date)<BR><BR>this will bring back the current date with out time.

  6. #6
    Eddie Campbell Guest

    Default Did I say DatePart ? What an idiot !

    I did of course mean DateValue :)

  7. #7
    Mike Shaffer Guest

    Default still no. ;-)

    Hi Al,<BR><BR>A date-type variable can contain both a date and a time simultaneously. If you simply assign a date-type variable to another variable, it won&#039;t return the date only as you suggest, but will still contain both.<BR><BR>The reliable way to parse out the date only (or the time only) from a date-type variable is to use the DateValue (or TimeValue) function(s).

  8. #8
    Ekow Guest


    try Format(rsRecordSet("dateFieldName"),"dd/mm/yyyy")

  9. #9
    Al Bear Guest

    Default Urrr YES!!!

    Well what I said works. try it for your self.

  10. #10
    tsl Guest

    Default RE: Did I say DatePart ? What an idiot !


Posting Permissions

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