Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Time in AM & PM

Author  Topic 

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2010-09-05 : 12:44:24
hi

I have a field this is stored with datetime datatype. I have managed to cast them to time but it show 24 hours format. How do i get them to display as AM and PM? thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-05 : 14:32:19
You can do this with the CONVERT function and the appropriate style in T-SQL, however you should instead be doing the formatting in the application. Formatting is best done by the presentation layer, your application. What programming language are you using for your app?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2010-09-05 : 23:09:07
I am using Vb.net. I'll do some research on that. thanks
Go to Top of Page

sg2255551
Constraint Violating Yak Guru

274 Posts

Posted - 2010-09-05 : 23:29:02
Thanks. I got it working. thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-05 : 23:55:14
You're welcome, glad to help.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -