English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm using datetimepicker control for entering time. The control's
format is set to custom and customFormat is HH:mm:ss tt.
In database time is getting saved as wel as date also.

2007-01-01 00:49:44 · 3 answers · asked by vishakha 1 in Computers & Internet Programming & Design

3 answers

If what you mean is, you want only the last time entered by any user to be stored whenever anyone uses a datetimepicker, just run a single update query with no conditions:

UPDATE timetable SET timecolumn = valueofpicker

2007-01-01 02:33:08 · answer #1 · answered by Anonymous · 0 0

SQL Servers stores dates and times in a date time column. You can view only the time portion by using the convert function with the convertion type of 108 like this.
SELECT CONVERT(VARCHAR(10), getdate(), 108)
This will display the servers current time.

You can also store the data in a text field if you would like, however this can place limitations on you in the future.

If you do store the times in a text field, and you later convert the data to a datetime data type the date of 1/1/1900 to the time. This can be tested with this command.
SELECT CONVERT(DATETIME, CONVERT(VARCHAR(10), getdate(), 108))

2007-01-04 13:07:53 · answer #2 · answered by mrdenny 2 · 0 0

all SQL date/time datatypes save the date as well as the time - it actually gets saved as a number like 12345.75 where the integer is the number of days since a pre-defined date (i think 1/1/900) and the fraction is the fraction of 24 hours

why not extract the time and save it in a text column ?

if you really want to use a date/time datatype then set the date to 0

2007-01-01 01:03:08 · answer #3 · answered by Ivanhoe Fats 6 · 0 0

fedest.com, questions and answers