mslinuz
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by mslinuz
-
-
i expect the last code will return a same value as $unix, since its originally created from that value.
which means its only : unix timestamp->human readable date->unix timestamp
that is what my example code is trying to do.
so if unix timestamp value is 123 then it should be : 123 ---> whatever ---> 123
but in the end it will never turns to 123
after a lil bit searching, ive found out that the guy who originally created the application lives in germany LOL...
so now i will try to do a date_default_timezone_set first before doing mktime
so the code will be :
<?php ...... date_default_timezone_set("Europe/Germany"); echo(mktime(0,0,0,$split[1],$split[0],$split[2])); ?>
Havent tried it yet tho, im currently not at the office.
Will report here the result by tomorrow morning.
Or maybe u guys wanna try the code a bit.
Thx for the help guys, i really appreciate it.
Cheers!!!
-
Ok, as there in the subject im a newbie..in PHP.
Somehow ive got a web app that i need to modify the code a bit.
This app was written by somebody else.
Inside the code, there is a routine that retrieve a date value from a form and then
convert it into unix timestamp using mktime() then store the value to database.
To present the date value to user, the unix timestamp stored in database is converted
using date().
Here is the sample code :
<?php $unix="1144188000"; //sample data $thedate=date('d/m/y',$unix); echo("the date : " . $thedate); // will result will be 05/04/06 echo("<br/>"); $split = explode("/", $thedate); echo(mktime(0,0,0,$split[1],$split[0],$split[2])); //I expect the result will be the same as $unix, but apparently its not ?>
In above example, the mktime() does NOT return a same value as $unix as I expect it to.
tyvm for all ur kind help.
Cheers!!!
[SOLVED] mktime returns different value [NEWBIE]
in PHP Coding Help
Posted
it is solved.
putting :
before doing mktime() solved the problem.
ps : the server im working now has different timezone with the orignal server in which this application was made.
thx for all your help.