Skip to content
Advertisement

AM/PM Conversion For Date Time

I’ve a very basic requirement that I did earlier but for now unable to resolve it. I’ve a table in database that stores in and out time as the following format:

So what I want is to convert the above into the below format:

Nothing complex here, just to convert from AM to PM. I tried something like this but not getting the exact result:

Anything that I missed here? Would appreciate if someone points out.

Advertisement

Answer

First of all, dates are stored in the internal format so you can not change it using what you are doing. What you see in database is the dates converted into the string.(human readable format)

You can try the following to achieve what you want:

This query will convert only dates before noon to equivalent in PM.

Cheers!!

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement