Reputation: 2075
i have a field that shows the date and time but i want to show only the time and would like to trim all the Date portion. Here is what i have:
Field1
Dec 30 1899 10:13AM
and i want to show only the time like this:
Field1
10:13AM
I would like to use an update function to accomplish this. How can i do this
UPDATE MyTable
SET Field1=Time...
thanks
Upvotes: 0
Views: 5470
Reputation: 45096
If you really need to use Update (not format in the select).
As long as Field1 is DatTime DataType is will have a date component.
Cannot remove the date with an update.
If you want a time only column then create a Time column e.g. Time1
Then
update mytable set Time1 = CAST(Field1 AS time)
Upvotes: 0