does time(7) need to be in military time

In the database, I have a column set to time(7)

Do time values always have to be in military time.  Can't they be in the normal time?
al4629740Asked:
Who is Participating?
 
duttcomConnect With a Mentor Commented:
The time format is HH:MM:SS and as such there is no value for a.m. or p.m. that would allow you to use 12 hour time instead of 24 hour time.
0
 
al4629740Author Commented:
So the answer is no.
0
 
duttcomCommented:
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
al4629740Author Commented:
It might be too complicated for me to do it.  I just need a datatype to show it.
0
 
duttcomCommented:
Try something like this in your select statement -

select CONVERT(varchar(15),YourTimeField,100) as YourTimeField
0
 
al4629740Author Commented:
Yes, thank you.  The main objective was to have it displayed inherently in the table.

Again.  Thanks
0
 
PortletPaulfreelancerCommented:
>> "The main objective was to have it displayed inherently in the table."

not sure what "displayed inherently" means, but a Time(7) field is NOT stored "in a format" at all. Date/Time information is actually stored as integers, but presented to us mere humans in a fashion that we comprehend as dates and/or times. e.g.

select YourTime7_field from yourtable;

will display a "default" time format, probably HH:MM;SS +0000000 and I don't think that default can be altered. You can however specify the format you want to see using convert e.g.
    CREATE TABLE Table1
    	([MyTime7] time(7))
    ;
    	
    INSERT INTO Table1
    	([MyTime7])
    VALUES
    	('23:35:45')
    ;

**Query 1**:

    select
      MyTime7
    , convert(varchar, MyTime7 ,9) am_pm_full_precision
    from table1
    

**[Results][2]**:
    
    |          MYTIME7 | AM_PM_FULL_PRECISION |
    |------------------|----------------------|
    | 23:35:45.0000000 |   11:35:45.0000000PM |



  [1]: http://sqlfiddle.com/#!6/2fd45/8

Open in new window

also see http://www.experts-exchange.com/Database/MS-SQL-Server/A_12315-SQL-Server-Date-Styles-formats-using-CONVERT.html
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.