Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Get am/pm from datetime in sql query
WhatsApp
Hiren Soni
12y
35
k
0
0
25
Blog
SELECT SUBSTRING(CONVERT(varchar(20), yourdate, 22), 18, 3) AS Expr1
FROM table
ORDER BY expr1 ;
SUBSTRING(CONVERT(varchar(20), yourdate, 22), 18, 3)-->it gives you a am/pm.
o/p:
----
am
pm
am
pm
Up Next
Change System DateTime Formate Using API
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
Membership not found