Hello,
I would do something like this.
1. Make sure a timezone string is saved with the user's profile. Once user
logs in, the timezone string can now be retrieved using the Auth component
($this->Auth->user('timezone')).
2. Let the user enter the date you need, hopefully in a usable format.
3. Use CakeTime::toServer($dateString, $timezone) to convert the user's
input back to UTC (which you already set your server's time to).
$dateString should be your user's input (strtotime parseable), and
$timezone should be the timezone string saved with your user's profile (see
#1).
4. ...
5. Profit.
HTH.
OJ
On Friday, March 20, 2015 at 4:29:08 PM UTC+8, Andreas Witte wrote:
>
> Hello everbody,
>
> I would kindly like to attract your attention to a question I wrote on
> stackoverflow yesterday.
>
> http://stackoverflow.com/questions/29127162/how-to-define-timezone-in-cakephp-datetime-form-object
>
> <http://www.google.com/url?q=http%3A%2F%2Fstackoverflow.com%2Fquestions%2F29127162%2Fhow-to-define-timezone-in-cakephp-datetime-form-object&sa=D&sntz=1&usg=AFQjCNGw8PZb5uzJc3oWqK77kC8K-PAK0w>
>
> Has anyone any best practice tutorial or any advice how to solve it?
>
> Thanks in advance and kind regards,
> Andreas
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.