Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Storing Just time in datetime

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Im currently writing a ASP script which has to store a time in a datetime function(hh/mm/ssAM), unfortunately everytime I try to insert anything it looks like this: 1/1/1900 2:03:00 AM, can anyone tell me how to get rid of the date and just display the time?
 
I'm pretty sure you can't 'store' a time without a date in a SQL table... but if you are aiming to display only the time, you can use the convert function using the style parameter to format your results.<br><br>declare @datefield smalldatetime<br>set @datefield = '1/1/1900 2:03:00 AM'<br><br>select convert(varchar, @datefield, 8)<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top