# |
Feb 9th 2018, 21:40 |
kevin |
I like it |
# |
Feb 9th 2018, 21:38 |
ricksaccous |
I'm going to eat lunch, good luck |
# |
Feb 9th 2018, 21:37 |
ricksaccous |
expense_date is of course a UTC time |
# |
Feb 9th 2018, 21:37 |
ricksaccous |
this is what i'm doing in my app to display to users from different timezones |
# |
Feb 9th 2018, 21:36 |
ricksaccous |
<?= $this->Time->format($expense->expense_date,null,null,$userTimezone); ?> |
# |
Feb 9th 2018, 21:36 |
kevin |
and im not going to use +01:00 format. I’ll use actual timezones, like ‘America/New York’ |
# |
Feb 9th 2018, 21:35 |
kevin |
yeah I get it. I made sure I changed the bootstrap and mysql db |
# |
Feb 9th 2018, 21:35 |
ricksaccous |
mostly because my knowledge on it is mostly play with it until it works, haha |
# |
Feb 9th 2018, 21:34 |
ricksaccous |
it's kind of hard to explain but yeah, you'll figure it out |
# |
Feb 9th 2018, 21:34 |
ricksaccous |
once |
# |
Feb 9th 2018, 21:34 |
ricksaccous |
would be easier to save it in UTC so you can change it onoce |
# |
Feb 9th 2018, 21:34 |
ricksaccous |
it's not that bad i guess, you just have to associate your timezone wiht the date being saved somehow and then change it from AZ to whatever user timezone is |
# |
Feb 9th 2018, 21:33 |
kevin |
yeah no im saving everything in -7 GMT, which is AZ time, which is obviously where im based |
# |
Feb 9th 2018, 21:33 |
ricksaccous |
yeah so you're not saving it in UTC |
# |
Feb 9th 2018, 21:33 |
kevin |
UTC* |
# |
Feb 9th 2018, 21:33 |
kevin |
GMT == UTZ |
# |
Feb 9th 2018, 21:33 |
kevin |
right? |
# |
Feb 9th 2018, 21:33 |
kevin |
no UTC is 0 |
# |
Feb 9th 2018, 21:33 |
kevin |
I changed it in the app to be -7 GMT |
# |
Feb 9th 2018, 21:33 |
ricksaccous |
lol |
# |
Feb 9th 2018, 21:33 |
ricksaccous |
I don't even know |
# |
Feb 9th 2018, 21:33 |
ricksaccous |
is -7 GMT same as UTC? |
# |
Feb 9th 2018, 21:33 |
ricksaccous |
the frozenTime object assumes UTC i think |
# |
Feb 9th 2018, 21:32 |
kevin |
any issue with my single point of truth being -7 GMT? |
# |
Feb 9th 2018, 21:32 |
ricksaccous |
that way you have a single point of truth when you change the Timezone per user |
# |
Feb 9th 2018, 21:31 |
ricksaccous |
but also, you should be storing times in your DB in UTC |
# |
Feb 9th 2018, 21:31 |
ricksaccous |
that's shown in the Helper docs i linked you |
# |
Feb 9th 2018, 21:31 |
kevin |
so my DB is in -7GMT, but I want to let people select their own timezone and have the displayed time adjust |
# |
Feb 9th 2018, 21:30 |
kevin |
yeah but im trying to implement account based timezones |
# |
Feb 9th 2018, 21:29 |
ricksaccous |
but your entity should already be a FrozenTime object |
# |
Feb 9th 2018, 21:29 |
ricksaccous |
actually it's fine i guess |
# |
Feb 9th 2018, 21:29 |
ricksaccous |
and use ummm |
# |
Feb 9th 2018, 21:29 |
ricksaccous |
it's actually best practice to not use that helper |
# |
Feb 9th 2018, 21:28 |
ricksaccous |
https://book.cakephp.org/3.0/en/views/helpers/time.html |
# |
Feb 9th 2018, 21:27 |
ricksaccous |
https://api.cakephp.org/3.3/class-Cake.View.Helper.TimeHelper.html |
# |
Feb 9th 2018, 21:27 |
ricksaccous |
there is no parse method |
# |
Feb 9th 2018, 21:26 |
kevin |
that line was pretty close… Call to a member function nice() on null |
# |
Feb 9th 2018, 21:26 |
ricksaccous |
so if you use html helper you would also do $this->Html |
# |
Feb 9th 2018, 21:26 |
ricksaccous |
rather |
# |
Feb 9th 2018, 21:26 |
ricksaccous |
well not all the same, they follow the same conventions |
# |
Feb 9th 2018, 21:26 |
ricksaccous |
all helpers are the same, you can see it in TimeHelper documentation |