I need help! Here's script:

<?php
date_default_timezone_set('Europe/Paris');
$time="1303889758";
echo $time."<br>";
$convert=date("G:i:s d. n. Y. ",$time);
//convert $time to our date: output is 9:35:58 27. 4. 2011. 
echo $convert."<br>";
$con2=mktime($convert);
//convert converted time to unix: doesn't work
echo $con2;
?>

I have two script. One script write the time to the document, and the second checks if the time is the same as now. I always get some weird time. And I made this program. And it doesn't work. what's mistake? Thanks!

Here's how you should be using the Date/Time features in PHP to achieve the same thing:

<?php
$tz = new DateTimeZone('Europe/Paris');
$time = new DateTime("@1303889758",$tz);
$time -> setTimeZone($tz);
$convert = $time -> format("G:i:s d. n. Y. ");
//convert $time to our date: output is 9:35:58 27. 4. 2011. 
echo $convert."<br>";
$con2 = $time -> format("U");
//convert converted time to unix: doesn't work
echo $con2;
?>

OK. Thanks a lot!

Be a part of the DaniWeb community

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