473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

gmdate of a gmmktime time is a day off

I tried running the following script on three different servers:

<?php
echo gmdate('m, d, Y', gmmktime(0,0,0,3,23,2000) );
?>

On two of the servers, I got 03, 23, 2000 back. On the other,
however, I got 03, 22, 2000. This doesn't make any sense to me.

On the servers that return the correct date (03, 23, 2000),
gmmktime(0,0,0,3,23,2000) returns 953769600. On the server that
returns the incorrect date (03, 22, 2000), gmmktime(0,0,0,3,23,2000)
returns 953766000. There's a difference of 3600 between the two,
which makes me think that some daylight savings time setting is to
blame.

I check php.net's entry on gmmktime and see this:

is_dst:
Parameters always represent a GMT date so is_dst doesn't influence
the result.

Thinking I'll try playing around with that setting, all the same, I
find that gmmktime(0,0,0,3,23,2000,1), when ran on the incorrect
server (which is running PHP 4.1.2 on Sun Solaris), gives the correct
answer. gmmktime(0,0,0,3,23,2000,0) gives the wrong answer.

So I try this out on my other servers. On one of the two servers that
was giving the correct answer (and which was running PHP 4.4.3 on some
distro of Linux), gmmktime(0,0,0,3,23,2000,0) gives the correct
answer, and gmmktime(0,0,0,3,23,2000,1) gives the wrong answer.

On the other server (running PHP 4.4.4 on Windows), the last parameter
doesn't make a difference. Again, this behavior is different than any
of the behaviors I've seen, already.

So what do I do?

Feb 13 '07 #1
0 1146

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dan glenn | last post by:
Say, I want to set a cookie and have it expire an hour after it's set. It's looking like this is only possible for browsers which are in the same time zone as my server?? In other words, if I...
4
by: Richard | last post by:
Hello: Environment: Linux server PHP 4.3.4 This code: echo '<br>'.strftime('%T %Z',mktime()).', Timestamp='.mktime();
10
by: Yang Li Ke | last post by:
Hi guys, Im about to build a script which will log visitor time spent on my website. I got a few ideas about this, maybe checking visitors ip and storing that info in db with time in and then...
1
by: Bathroom_Monkey | last post by:
I've got a newb question about Daylight Savings Time (DST). First of all here is some server info: Apache 1.3.28 PHP 4.3.6 MySQL 3.23.49 Time is set to GMT My goal is to be able to...
2
by: yawnmoth | last post by:
gmdate('F j, Y, g:i a',0) returns January 1, 1970, 12:00 am. How do I add to the second parameter of the date function to make it always return that same date, regardless of the time zone?...
8
by: Bart Nessux | last post by:
am I doing this wrong: print (time.time() / 60) / 60 #time.time has been running for many hours if time.time() was (21600/60) then that would equal 360/60 which would be 6, but I'm not getting...
18
by: bart_nessux | last post by:
I need a script to call several functions at the same time. How does one call more than one function simultaneously?
5
by: David Stockwell | last post by:
I'm sure this has been asked before, but I wasn't able to find it. First off I know u can't change a tuple but if I wanted to increment a time tuple by one day what is the standard method to do...
6
by: Rebecca Smith | last post by:
Today’s question involves two time text boxes each set to a different time zone. Initially txtCurrentTime will be set to Pacific Time or system time. This will change with system time as we travel...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.