Wednesday, November 25, 2009

Re: handling timezone and DST opinions please

I took a different approach and let the db handle it for me.

Refer to my last reply in this thread:
http://groups.google.com/group/cake-php/browse_frm/thread/de3efc2bc06d1edf/5a6a74abefddc316

On Nov 25, 6:40 pm, euromark <dereurom...@googlemail.com> wrote:
> i just myself similar questions yesterday
> i played with set_locale() as well as time zones
>
> reading out dates and displaying it via date_default_timezone_set() in
> the specific time is straightforward.
> i was wondering too how inserting/editing dates would work with
> different time zones
>
> not only in add(), but also in edit() or any other form input where
> you have to
> a) translate time from server time to local time
> b) put this value in the input field
> c) on save re-translate it back to server time
> d) save it
>
> e.g.:
> if the server time is GMT+1 and sombody from GMT-6 with his timezone
> set to this timezone enters a datetime like
> "2009-11-11 11:11:11"
> now it should be saved with GMT+1 again ("2009-11-11 11:19:11") so
> that other users with different timezones get the correct result as
> well
>
> so maybe we have to use beforeValidate() and afterFind() to make sure
> the users always have the right time value...?
>
> any other approaches?
> or does date_default_timezone_set() automatically translate those back
> and forth on post?
>
> thx
>
> On 23 Nov., 23:25, Jas <mciver.ja...@gmail.com> wrote:
>
> > date_default_timezone_set() sets the timezone for all other date and
> > time functions used in the same script, so you wont have to keep
> > specifying it.
>
> > In what timezone do you store your records that have dates? Do you use
> > a common one like GMT 0, Then use the users preferred timezone when
> > displaying it?
>
> > thanks
>
> > On Nov 24, 1:11 am, jacmoe <jac...@mail.dk> wrote:
>
> > > I had the same issue and now use gmdate everywhere.
> > > Tested it on two servers in different timezones, and it worked
> > > alright.
>
> > > On Nov 23, 11:29 am, Jas <mciver.ja...@gmail.com> wrote:
>
> > > > I'd like to know the best way to store records on a server in another
> > > > country. Some of the users will be in other countries. when they view
> > > > their own records (they cant see records of the other users) the dates
> > > > need to display in their local timezone.
> > > > I don't want to store the date as their local time incase they change
> > > > their timezone.
>
> > > > Part 2 of that problem is how to apply DST (Daylight Savings time)?
>
> > > > Does this make any sense?
> > > > How would you handle storing data in a common timezone and display it
> > > > to the user as their preferred timezone?
>
> > > > The main reason for this, is I think I'll be changing webservers and
> > > > will most likely be in a different county. So the servers timezone
> > > > shouldn't have any impact on the data.
>
> > > > On Nov 23, 9:15 pm, Amit Rawat <rawatami...@gmail.com> wrote:
>
> > > > > ok so whats your main problem?
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: