473,320 Members | 1,823 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,320 software developers and data experts.

Date time stamp help

Hey folks,

I'm moving from ASP to PHP and I must say that on using this for only a day
it is MUCH simpler to get things going. Already have made a VERY basic blog
site for myself in a very short period of time. Anyhow I have a datetime
issue:

On my blog site I capture the date like this: $date=date("Y-m-d g-i-s");

When I display this date later it is 2 hours being my time. I'm guessing
that the servers are somewhere in the mid west - I am in the EST time zone.
Can anyone help me correct this so that I either capture the time proplerly
or display it in my zone?

Thanks,
Dave
Jul 17 '05 #1
6 4240
An noise sounding like Dave said:
Hey folks,

I'm moving from ASP to PHP and I must say that on using this for only a day
it is MUCH simpler to get things going. Already have made a VERY basic blog
site for myself in a very short period of time. Anyhow I have a datetime
issue:

On my blog site I capture the date like this: $date=date("Y-m-d g-i-s");
$date = date("Y-m-d ").(date('g')-2).date('-i-s');
Don't you just love dirty hacks.
When I display this date later it is 2 hours being my time. I'm guessing
that the servers are somewhere in the mid west - I am in the EST time zone.
Can anyone help me correct this so that I either capture the time proplerly
or display it in my zone?

Thanks,
Dave

--

/(bb|[^b]{2})/
Trees with square roots don't have very natural logs.

Jul 17 '05 #2

"Dave" <ov******@cogeco.ca> wrote in message
news:Qu******************@read1.cgocable.net...
Hey folks,

I'm moving from ASP to PHP and I must say that on using this for only a day it is MUCH simpler to get things going. Already have made a VERY basic blog site for myself in a very short period of time. Anyhow I have a datetime
issue:

On my blog site I capture the date like this: $date=date("Y-m-d g-i-s");

When I display this date later it is 2 hours being my time. I'm guessing
that the servers are somewhere in the mid west - I am in the EST time zone. Can anyone help me correct this so that I either capture the time proplerly or display it in my zone?

Thanks,
Dave


$date=date("Y-m-d g-i-s", time() + 120);


--
Project Wapache - http://wapache.sourceforge.net
Jul 17 '05 #3
Dave wrote:
Hey folks,

I'm moving from ASP to PHP and I must say that on using this for only a day
it is MUCH simpler to get things going. Already have made a VERY basic blog
site for myself in a very short period of time. Anyhow I have a datetime
issue:

On my blog site I capture the date like this: $date=date("Y-m-d g-i-s");

When I display this date later it is 2 hours being my time. I'm guessing
that the servers are somewhere in the mid west - I am in the EST time zone.
Can anyone help me correct this so that I either capture the time proplerly
or display it in my zone?

Thanks,
Dave

Dave,

This code also accounts for daylight savings time for my time offset
which is -8 (Pacific):

echo gmdate('Y-m-d g:i s', time() + 3600*(-8 + date('I')))

Why change your code twice a year?

Miki
Jul 17 '05 #4
Well if the time is being captured on the server side and I'm adding 2 hours
to that in my code - how would day light savings come into play?

"michelle" <miki@spam_me.net> wrote in message
news:hb********************@comcast.com...
Dave wrote:
Hey folks,

I'm moving from ASP to PHP and I must say that on using this for only a
day it is MUCH simpler to get things going. Already have made a VERY
basic blog site for myself in a very short period of time. Anyhow I have
a datetime issue:

On my blog site I capture the date like this: $date=date("Y-m-d g-i-s");

When I display this date later it is 2 hours being my time. I'm guessing
that the servers are somewhere in the mid west - I am in the EST time
zone. Can anyone help me correct this so that I either capture the time
proplerly or display it in my zone?

Thanks,
Dave

Dave,

This code also accounts for daylight savings time for my time offset which
is -8 (Pacific):

echo gmdate('Y-m-d g:i s', time() + 3600*(-8 + date('I')))

Why change your code twice a year?

Miki

Jul 17 '05 #5
Dave wrote:
Well if the time is being captured on the server side and I'm adding 2 hours
to that in my code - how would day light savings come into play?

"michelle" <miki@spam_me.net> wrote in message
news:hb********************@comcast.com...
Dave wrote:
Hey folks,

I'm moving from ASP to PHP and I must say that on using this for only a
day it is MUCH simpler to get things going. Already have made a VERY
basic blog site for myself in a very short period of time. Anyhow I have
a datetime issue:

On my blog site I capture the date like this: $date=date("Y-m-d g-i-s");

When I display this date later it is 2 hours being my time. I'm guessing
that the servers are somewhere in the mid west - I am in the EST time
zone. Can anyone help me correct this so that I either capture the time
proplerly or display it in my zone?

Thanks,
Dave


Dave,

This code also accounts for daylight savings time for my time offset which
is -8 (Pacific):

echo gmdate('Y-m-d g:i s', time() + 3600*(-8 + date('I')))

Why change your code twice a year?

Miki


The safest way to do this is to use the gmdate() function, which doesn't
take into account daylight savings time...it is simply GMT. You can
do it your way if you are positive that your server will not move. But
my suggestion will make your code more portable - if you move it to
another server. If you do move to another server in another time zone
you will have to rewrite this portion of code...and if you use this
thinking throughout your work there will be more changes, too. The way I
suggest is a simple set it and forget it method...but you can do it your
way if you like.

Miki
Jul 17 '05 #6
"Dave" <ov******@cogeco.ca> wrote:

Well if the time is being captured on the server side and I'm adding 2 hours
to that in my code - how would day light savings come into play?


Your domain is in Canada. In Canada, all of the time zones enter and exit
daylight savings time at the same time. Thus, when YOU go into DST, your
server will also have gone into DST.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 17 '05 #7

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

Similar topics

5
by: akoper | last post by:
I have a table that is a project. Each record is a task in the project. One field in each record is a date/time stamp for when that task was completed. I need to be able to: 1) compute how much...
7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
3
by: fong.yang | last post by:
I have a textbox on my form label date/time. I also added a date/time column to my table as well. The table already contains records before the date/time column was added. How do I setup a...
6
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital...
5
by: Des | last post by:
I have to do an events calender for a church. The events display will be limited to that week. If someone went in today Wed 24th I want to display 21st to 27th. I dont want any code samples, just...
3
by: phried1 | last post by:
I have created a form and inserted the following tables: Date Entered Time Entered Date Modified Time Modified Essentially how and where can I have these dates and times recorded so when the...
1
by: Susan Bricker | last post by:
Greetings. I have a report (actually all of my reports in an MDB) that I want to date/time stamp at the bottom. Previously, I had used the builtin function of Now(). I thought that would give...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
4
by: Tang | last post by:
Hi, could anybody help me with this please I want to add a date stamp in a table, it should automaticlly updated when another field in the same table is selected as "Yes". I am not very good at...
16
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.