Im creating a time-base site wherein the timestamp should rely on the global time
and not to my PC's time (because it can be out-dated somethimes).
How can I do that?
rakwel10
0
Junior Poster in Training
Recommended Answers
Jump to PostUnless is specified by localtime(), time_zone cookies and so on, PHP works with the server time, not with client time, if you want to use GMT then use gmdate():
<?php echo gmdate('c'); echo date('c'); ?>
Jump to PostIf the user register to the website you can ask for the timezone location, at that point your script becomes:
<?php date_default_timezone_set('Europe/London'); # or America/New_York echo gmdate('c') . "\n"; echo date('c') . "\n"; ?>
All 8 Replies
cereal
1,524
Nearly a Senior Poster
Featured Poster
rakwel10
0
Junior Poster in Training
cereal
1,524
Nearly a Senior Poster
Featured Poster
rakwel10
0
Junior Poster in Training
cereal
1,524
Nearly a Senior Poster
Featured Poster
rakwel10
0
Junior Poster in Training
rakwel10
0
Junior Poster in Training
cereal
1,524
Nearly a Senior Poster
Featured Poster
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.