For presentation purpose only AM, PM is required...
Better to use proper data types for storing datetime values...
If you use
VARCHAR(10) it may cause problem in future. Any one can enter different formats of time values such as 01:00 AM, 01.11 Am, 1 AM, 1.00 AM
For suppose if you wish to get date and time from two fields DATEColumn and TimeColumn
you will definitely get errors in future...
if you use DATETIME type to store time values....
--sample code
DECLARE @foo TABLE
(
dt DATETIME
)
INSERT @foo(dt) VALUES('20011031')
INSERT @foo(dt) VALUES('3:25 PM')
SELECT RIGHT(CONVERT(VARCHAR(20), dt, 100), 7), dt FROM @foo
--Results
-------
12:00AM
3:25PM
Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif
Raghuldrag, if this helps please login to Mark As Answer. | Alert Moderator