Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

convert datetime into string

bloomer

Recruit
Basic Member
Messages
11
Reaction score
0
Points
16
paano i convert yung datetime into string sa php.
salamat po
 
$date = new DateTime('2000-01-01');
$result = $date->format('Y-m-d H:i:s');

if ($result) {
echo $result;
} else { // format failed
echo "Unknown Time";
}
 
$discount_start_date = '03/27/2012 18:47';
$start_date = date('Y-m-d H:i:s', strtotime($discount_start_date));
 
You can use the format method of the DateTime class:

$date = new DateTime('2000-01-01');
$result = $date->format('Y-m-d H:i:s');

If format fails for some reason, it will return FALSE. In some applications, it might make sense to handle the failing case:

if ($result) {
echo $result;
} else { // format failed
echo "Unknown Time";
}

or visit this link: http://stackoverflow.com/questions/10569053/convert-datetime-to-string-php
 
Back
Top Bottom