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?
Intuitively, it seems like date('F j, Y, g:i a',0 - date('Z')) should
do it, but on my system, that's an hour off.
Here's some sample code:
<?
echo gmdate('F j, Y, g:i a',0).'<br />';
echo date('F j, Y, g:i a',0 - date('Z')).'<br />';
echo date('F j, Y, g:i a',0 - date('Z') + 60*60);
?>
And here's the output on my system:
January 1, 1970, 12:00 am
December 31, 1969, 11:00 pm
January 1, 1970, 12:00 am
Will the last echo always return the same thing as the first echo,
regardless of the time zone? If so, why? It seems that the second one
is the one that should do it - not the first one. 2 1992
yawnmoth wrote: 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? <snip>
Never mind - I figured the answer out, myself. I need to correct for
daylight savings time.
date('F j, Y, g:i a',0 - date('Z') + 60*60*date('I')) does it.
yawnmoth wrote: Will the last echo always return the same thing as the first echo, regardless of the time zone? If so, why? It seems that the second one is the one that should do it - not the first one.
erm... daylight savings perhaps? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: |-|erc |
last post by:
Hi!
Small challenge for you.
The index.php uses this file and calls layout(). Take a look at www.chatty.net this file
draws the chat login box on the right. I traced the CHAT button it submits...
|
by: mitch-co2 |
last post by:
What I am trying to do is when someone clicks on the YES radio button I
want the text field called MYTEXT to equal the text field named DATE.
The below code works as long as I do NOT UN-COMMENT...
|
by: Elliot Marks |
last post by:
Under what circumstances would a C program, containing nothing
that is not standard C, prefix a zero result of a calculation
with doubles with a minus sign? I have written a program that
does...
|
by: Rock |
last post by:
I'm in the process of writing this program for complex numbers and I
use DevC++. My professor on the other hand compiles on Borland 5.5. So
I ocasionally save and run my work on Borland to see if...
|
by: Simon Harvey |
last post by:
Hi all,
I'm having a bit of a problem working with dates. My computer is british,
but I'm developing an american application so I therefore need to use american
dates. But I can't get my...
| |
by: CBFalconer |
last post by:
We often find hidden, and totally unnecessary, assumptions being
made in code. The following leans heavily on one particular
example, which happens to be in C. However similar things can (and...
|
by: Evan Carmi |
last post by:
hi,
i am creating a program to go through a directory structure recursively
(including directories below it) and move all files that end in .msf to
a directory above the current level.
the...
|
by: yawnmoth |
last post by:
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,...
|
by: Masood |
last post by:
I know that this topic may inflame the "C language Taleban", but is
there any prospect of some of the neat features of C++ getting
incorporated in C? No I am not talking out the OO stuff. I am...
|
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...
|
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,...
| |
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...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |