ASP, SQL and time

  • Hello,

    I have a problem for quite sometime in my website. I have a table and two fields that record the date and time introduced by some user. Both fields are datetime format. The problem is that in the time field the information if recorded as if it a date. So I didn't find any solution for this problem. Can someone help me out? Thank you.

  • Why do you have two separate fields when you can have both date and time in one field(Column).

    To show only the time you can use the CONVERT functions.

  • Also, be sure you are storing this data from the SQL server not the ASP server. Will prevent time issues when comparing things.

    Steve Jones

    sjones@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/sjones

  • Also CONVERT can make it easier breaking pieces apart if you do this for viewing while you can store as one field or 2 like suggested before. However, do you mean that when the time is entered it looks to sql like 010101 is being ebtered and translated as 1/1/2001 or 1/1/1900 1:01:01, if the first you need to format your time differently when entering so it can distinguish by hh:mm:ss with the :'s.

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply