How to know the time coming form databse is in 'am' or 'pm'?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
RishikeshJha
Forum Newbie
Posts: 11
Joined: Tue Mar 31, 2009 1:54 am

How to know the time coming form databse is in 'am' or 'pm'?

Post by RishikeshJha »

Hi,

i used to store joing date in datetime fromate in mysql. i want to fetch this field and show it in frontend like 2 april 2009 01:07 am or 2 april 2009 01:07 pm. Can anyone give me soloution how i can know that the time is in am or pm???

Thanks in advance.....

Rishikesh
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to know the time coming form databse is in 'am' or 'pm'?

Post by requinix »

If the hour is 0 then it's midnight, 1-11 is AM, 12 is noon, and 13-23 is PM (subtract 12).

Or you could let MySQL do it for you.
RishikeshJha
Forum Newbie
Posts: 11
Joined: Tue Mar 31, 2009 1:54 am

Re: How to know the time coming form databse is in 'am' or 'pm'?

Post by RishikeshJha »

tasairis wrote:If the hour is 0 then it's midnight, 1-11 is AM, 12 is noon, and 13-23 is PM (subtract 12).

Or you could let MySQL do it for you.
thanks dear it?????
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to know the time coming form databse is in 'am' or 'pm'?

Post by requinix »

RishikeshJha wrote:thanks dear it?????
Was that a question?
Post Reply