Converting GETDATE to 24-Hour Format

Question:
Using GETDATE returns the time portion of the date in the 12-hour clock form (“08:30pm”). I need the time portion to be in 24-hour clock form (“20:30”). I can’t figure out how to convert to a 24-hour clock format. Any suggestions?

Answer:
Sure, try this:

 select convert(character(14),getdate(),114)

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist