TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
SQL Date Format in HH:MM AM/PM
Soumalya Das
Aug 09
2016
Code
1.1
k
0
2
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
For HH:MM am/pm:
SELECT
LTRIM(
Right
(
REPLACE
(
CONVERT
(nvarchar(
MAX
),
CAST
(GetDate()
as
smalldatetime), 109),
':00:000'
,
' '
), 8))
as
[
current_time
]
For HH:MM:SS am/pm:
select
CONVERT
(
VARCHAR
(8), getdate(), 108)
+
' '
+
RIGHT
(
CONVERT
(
VARCHAR
(30), getdate(), 9), 2)
Sql date format