473,857 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

newbee stupid question regarding $initstartdate = date("d-m-Y");

Hi there

I have

$initstartdate = date("d-m-Y");

in my code

How can I get it to be date() + 1 or 7 for that matter. Because my server is in the US and I am in New Zealand, they are always a
day behind....

I have looked at php.net, I just could not work it out ...

Thank you

- Nicolaas
Jul 23 '05 #1
16 2116
sorry this one was supposed to go to php group ...
Hi there

I have

$initstartdate = date("d-m-Y");

in my code

How can I get it to be date() + 1 or 7 for that matter. Because my server is in the US and I am in New Zealand, they are always a
day behind....

I have looked at php.net, I just could not work it out ...

Thank you

- Nicolaas


Jul 23 '05 #2
On Sun, 30 Jan 2005 16:10:12 +1300 WindAndWaves wrote:
sorry this one was supposed to go to php group ...
Hi there I have $initstartdate = date("d-m-Y"); in my code How can I get it to be date() + 1 or 7 for that matter. Because my
server is in the US and I am in New Zealand, they are always a
day behind.... I have looked at php.net, I just could not work it out ... Thank you - Nicolaas


While you're working on the script, set your clock to a US time zone.
If you add anything to YOUR script, then those in the US would see it wrong.


Jul 23 '05 #3

"Richard" <An*******@127. 001> wrote in message news:ct******** *@news2.newsguy .com...
On Sun, 30 Jan 2005 16:10:12 +1300 WindAndWaves wrote:
sorry this one was supposed to go to php group ...


Hi there

I have

$initstartdate = date("d-m-Y");

in my code

How can I get it to be date() + 1 or 7 for that matter. Because my
server is in the US and I am in New Zealand, they are always a
day behind....

I have looked at php.net, I just could not work it out ...

Thank you

- Nicolaas


While you're working on the script, set your clock to a US time zone.
If you add anything to YOUR script, then those in the US would see it wrong.


Well, Richard, we are in New Zealand and not in the US. We also format the date as mm-dd-yyyy. Furthermore, it is OK to be one day
ahead - it makes sense in context (hotel booking service), but one day in the past looks stupid.

Is there an alternative answer?

Thank you for your reply.

- Nicolaas
Jul 23 '05 #4
On Sun, 30 Jan 2005 17:09:57 +1300 WindAndWaves wrote:

"Richard" <An*******@127. 001> wrote in message
news:ct******** *@news2.newsguy .com...
On Sun, 30 Jan 2005 16:10:12 +1300 WindAndWaves wrote:
> sorry this one was supposed to go to php group ...
> Hi there > I have > $initstartdate = date("d-m-Y"); > in my code > How can I get it to be date() + 1 or 7 for that matter. Because my
> server is in the US and I am in New Zealand, they are always a
> day behind.... > I have looked at php.net, I just could not work it out ... > Thank you > - Nicolaas
While you're working on the script, set your clock to a US time zone.
If you add anything to YOUR script, then those in the US would see it
wrong.

Well, Richard, we are in New Zealand and not in the US. We also format
the date as mm-dd-yyyy. Furthermore, it is OK to be one day
ahead - it makes sense in context (hotel booking service), but one day
in the past looks stupid. Is there an alternative answer? Thank you for your reply. - Nicolaas

Set it to GMT????

Jul 23 '05 #5
WindAndWaves wrote:
"Richard" <An*******@127. 001> wrote in message news:ct******** *@news2.newsguy .com...
On Sun, 30 Jan 2005 16:10:12 +1300 WindAndWaves wrote:

sorry this one was supposed to go to php group ...


Hi there

I have

$initstartdate = date("d-m-Y");

in my code

How can I get it to be date() + 1 or 7 for that matter. Because my
server is in the US and I am in New Zealand, they are always a
day behind....

I have looked at php.net, I just could not work it out ...

Thank you

- Nicolaas


While you're working on the script, set your clock to a US time zone.
If you add anything to YOUR script, then those in the US would see it wrong.

Well, Richard, we are in New Zealand and not in the US. We also format the date as mm-dd-yyyy. Furthermore, it is OK to be one day
ahead - it makes sense in context (hotel booking service), but one day in the past looks stupid.

Is there an alternative answer?

Thank you for your reply.

- Nicolaas

So am I and I bl**dy don't. Nor does anyone else I know. dd/mm/yyyy.
However, I agree with the arrogance of any poster demanding we use an US TZ!

To answer the problem that you've got requires javascript to be run on
the client machine to get the time offset. Once you've got that, then
you can offset by using putenv ("TZ=$timezone" ) to modify the server
timezone to the same value.

That's how I've done it in the past. I save all datestamps in Mysql as
UTC to make life easier as well.
Steve
Proudly GMT+13.
Jul 23 '05 #6
I noticed that Message-ID: <ct**********@l ust.ihug.co.nz> from Steve
contained the following:
To answer the problem that you've got requires javascript to be run on
the client machine to get the time offset. Once you've got that, then
you can offset by using putenv ("TZ=$timezone" ) to modify the server
timezone to the same value.

That's how I've done it in the past. I save all datestamps in Mysql as
UTC to make life easier as well.


The OP just wants to offset the date by a fixed amount to compensate for
the fact that the server is in the States. So he could either add a
known number of seconds to time() or use strtotime()

$timestamp=strt otime(+n hours); //where n is the time difference

$initstartdate = date("d-m-Y",$timestam p);

Not sure how daylight saving would affect that though.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 23 '05 #7

"Geoff Berrow" <bl******@ckdog .co.uk> wrote in message news:4q******** *************** *********@4ax.c om...
I noticed that Message-ID: <ct**********@l ust.ihug.co.nz> from Steve
contained the following:
To answer the problem that you've got requires javascript to be run on
the client machine to get the time offset. Once you've got that, then
you can offset by using putenv ("TZ=$timezone" ) to modify the server
timezone to the same value.

That's how I've done it in the past. I save all datestamps in Mysql as
UTC to make life easier as well.


The OP just wants to offset the date by a fixed amount to compensate for
the fact that the server is in the States. So he could either add a
known number of seconds to time() or use strtotime()

$timestamp=strt otime(+n hours); //where n is the time difference

$initstartdate = date("d-m-Y",$timestam p);

Not sure how daylight saving would affect that though.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/


Hi Guys

Lets not get too pedantic here. I like this timestamp thing, I will just add a couple of hours. In the exciting world of travel
hours a pretty messy anyway and all I wanted to do is to have a feasible start date for a trip (they can change it themselves if
they want to...).

Thanks for all your interesting answers I will

Nicolaas +as many as possible

PS la luche sigue....
Jul 23 '05 #8
I noticed that Message-ID: <bU************ *********@news. xtra.co.nz>
from WindAndWaves contained the following:
I like this timestamp thing, I will just add a couple of hours. In the exciting world of travel
hours a pretty messy anyway and all I wanted to do is to have a feasible start date for a trip (they can change it themselves if
they want to...).


Pragmatism. I like that. :-)

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 23 '05 #9
On Sun, 30 Jan 2005 10:20:04 +0000, Geoff Berrow
<bl******@ckdog .co.uk> reverently intoned upon the aether:
I noticed that Message-ID: <ct**********@l ust.ihug.co.nz> from Steve
contained the following:
To answer the problem that you've got requires javascript to be run on
the client machine to get the time offset. Once you've got that, then
you can offset by using putenv ("TZ=$timezone" ) to modify the server
timezone to the same value.

That's how I've done it in the past. I save all datestamps in Mysql as
UTC to make life easier as well.


The OP just wants to offset the date by a fixed amount to compensate for
the fact that the server is in the States. So he could either add a
known number of seconds to time() or use strtotime()

$timestamp=strt otime(+n hours); //where n is the time difference

$initstartdate = date("d-m-Y",$timestam p);

Not sure how daylight saving would affect that though.


DST should not affect time() which is measured in seconds since the
Unix epoch. I have not researched this too far since I use servers in
Arizona where DST is never observed (the time is constant). But if
one just used time() and adds hours_offset*36 00 to time it will solve
the problem. I would suspect that DST affects date() though.

Also, to a prior poster, Javascript is a poor choice as the
application should no the time zone of each hotel, hence the offset
should be known by the server for each hotel which appears to be only
two time zone for New Zealand.

from: http://www.statoids.com/tnz.html
UTC+12:oo for NZST
UTC+12:45 for CHAST (the Chatham Islands)

From the first Sunday in October to the third Sunday in March
UTC+13:oo for NZDT
UTC+13:45 for CHADT

That said, there is plenty of discussion in the PHP manual if you read
the user comments.

http://us3.php.net/manual/en/function.date.php

And of course one should test one's server and check with the system
administrators to get their time maintenance policy.

enjoy,

Sean

"In the End, we will remember not the words of our enemies,
but the silence of our friends."

- Martin Luther King Jr. (1929-1968)

Photo Archive @ http://www.tearnet.com/Sean
Last Updated 29 Sept. 2004
Jul 23 '05 #10

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

Similar topics

7
1759
by: Martin Feuersteiner | last post by:
Hi! I would be grateful for any advise regarding what I'm doing wrong.. My brain is stuck. Probably some stupid simple mistake I don't see. Thanks very much for your efforts! Martin I have this code: DECLARE @ContactID varchar(10),
1
1245
by: Claude Vernier | last post by:
Hi, I already got a nice Web application running and need to adapt it for iPaqs, Smartphone and Blackberry. Can you suggest a better newsgroup if any and some links to find best practices and help on how to start ?? Among questions: - I want the Default.aspx from the main site to redirect if Windows CE is
2
1670
by: Newbee Adam | last post by:
some said that .NET app can run on any program where rutime exists. What is "runtime" in this sense? will I have to install runtime or .net framework or .NET support on an xp machine for a .NET app to work? keep in mind I am a newbee :-) !! thanks --
119
4659
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see, http://www.alistapart.com/articles/betterliving/ I read on http://msdn.microsoft.com/netframework/default.aspx?pull=/library/en-us/dnnetdep/html/netfxcompat.asp It said they changed stuff like this
2
1416
by: Newbee Adam | last post by:
is it stored in a directory on hard drive, if so where? -- Adam S
2
1554
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I was testing an application that is writing a mail and sends it to a recieptiens. I then came across a couple of ??? in my head, coul anyone briefly tell me what the difference is between this and where in the help i can read more about it First out... Outlook.Application oApp = new Outlook.Application();
1
1162
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi all! Sorry if this is the wrong NG for this type of Q. On my .aspx page i have a TextControl and a button. When i press the button, i want to insert the changes to my SQL database how do i achive this... Retrieving data is done by the DataBind i thing but, inserting, and
1
1136
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi all! Sorry if this is the wrong NG for this type of Q. On my .aspx page i have a TextControl and a button. When i press the button, i want to insert the changes to my SQL database how do i achive this... Retrieving data is done by the DataBind i thing but, inserting, and
2
1732
by: Rene | last post by:
Hello to all! I am a newbee to C++, I did a beginners' course, and now I am stuck with a strange problem. I have written the function that is pasted downwards. The peculiar thing is that when I sent the function the value "0", the .lst file is created properly (the vector I am using/saving is made up of structs of one AnsiString (using BCB) called "naam" and one int called "nummer", I guess You'll get what they mean in English ;-))....
0
9768
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,...
0
11083
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, 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...
0
10711
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 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...
1
10808
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10394
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 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...
0
7104
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5971
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4592
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
2
4191
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.