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 2001
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 and
goes to the index file again, I can't figure out how it opens the chatroom. I want
to get it to skip the login box and go straight to the room, with user name "guest"
or "" or whatever but I'll add a field to type the name in the chat room....
|
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 the NO radio
button, once I do that it will not work.
Any help would be greatly appreciated.
Mitch
|
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 operations on matrices. Some, but not all, of the zeroes in
the result matrices are displayed by printf as -0.0. (I know that
floating point arithmetic algorithms use positive and negative
zero but this is the first time I've seen negative zeroes in...
|
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 it caught
anything, it's very picky... Anyway, the code below works on Dev, and
it compiles fine on Borland, but when I run it from borland, there is
no output, no error, it just skips right over the freind ostream call.
HELP! I'm new to this...
|
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 DateTime object to "act" american.
Let me give an example:
In order to take in an american date, I tell it which culture the date will
be formatted according to:
| |
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
do) occur in any language.
These assumptions are generally made because of familiarity with
the language. As a non-code example, consider the idea that the
faulty code is written by blackguards bent on foulling the
language. The term...
|
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 code i have so far is as follows:
<code>
|
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,
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),
|
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 talking
about the non-OO stuff, that seems to be handled much more elegantly in
C++, as compared to C. For example new & delete, references, consts,
declaring variables just before use etc.
I am asking this question with a vested interest. I...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 we have to send another system
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |