hi guys,,, Can Anyone help me in my problem. I want to exclude the second and instead i will use the Am/Pm. I did exclude the seconds but I can't include the AM/Pm function.
I used this code

<?php echo ('A'); ?>

but this is static.. how could I used this, I have no field in the table for Am/PM

Recommended Answers

Hey consider the below code -

$fromDB;   //This is datetime object from the database
$date = new DateTime($fromDB);
//$date->modify('');
echo $date->format("h:i A");

Hope this works for you, if still not post the problem again.

Jump to Post

All 3 Replies

Hey consider the below code -

$fromDB;   //This is datetime object from the database
$date = new DateTime($fromDB);
//$date->modify('');
echo $date->format("h:i A");

Hope this works for you, if still not post the problem again.

i have also a problem..because the user will only input from a 12 hr format with an AM/PM

the user will only select from 01-12 and select form AM and PM..do you have functions on that?

post part of your code where you are stucked up

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.