By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,600 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,600 IT Pros & Developers. It's quick & easy.

time stamp data type

P: 24
Hi,

I want to enter only time from frontend & not date time.
Can I do this & can I store this in DB. If yes, what will be data type to store only time values. How do I retrieve the time data in case I want to find difference.
Please reply.

Thanks
Shubhangi
Sep 18 '06 #1
Share this Question
Share on Google+
2 Replies


aramki
P: 9
You could use a char field to store your time so it looks like the time only, but I would recommend to use the datetime field to be more accurate and display the data formatted using the convert function, also having the datetime field allows you to use the datediff function to calculate time difference.
Sep 18 '06 #2

P: 19
Hi,
Answer is
--------------
select convert(varchar,getdate(),114)

select convert(varchar,ts,114) from tablename

Here ts is the column name and its datatype is datetime

Regards
Ram ASP
Sep 23 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.