It depends which you want. Times in the db should always be in UTC,
so in the first case it is testing against the start of the day in
local time, which is 23:00 UTC. In the second case it is testing
against the start of the day UTC. So the decision is yours, if you
want your scope to return events from today local time then use the
former, if you want today UTC then use the later. It all depends on
what you mean by 'today'.
It depends which you want. Times in the db should always be in UTC,
so in the first case it is testing against the start of the day in
local time, which is 23:00 UTC. In the second case it is testing
against the start of the day UTC. So the decision is yours, if you
want your scope to return events from today local time then use the
former, if you want today UTC then use the later. It all depends on
what you mean by 'today'.
And, by "local time" he means "server's local time" not necessarily the
"local time" for the actual user. If you want to support the "user's
local time" then you'll need to know the time zone where the user
actually resides. Typically that's just something you'll have to ask
them when they create their account so you can store their local time
zone along with their account information.
Thanks Robert & Colin, in the current case , server and users are in
the same Time zone ( UTC+1) so server local time is user local time
( my UNIX box is UTC+1)
by today , I always mean user's today which is local time
so as per your answer when I make a local time query, it's normal to
have it 'converted' into utc for comparisons
so => all events are created at user's local time , then stored in
UTC
if I need to query last week user's events, then my query should use
local time ( system will convert the query times to UTC and compare
with stored db UTC times)
I understand ... I dream about a format Date + am:pm ! ( created
in the morning or created in the afternoon...) LOL
more, I need Time.... actually I need to split events into morning /
afternoon events ( half day am:pm )
projects have half-day tasks only..
I found very useful the business_days gem, but nothing regarding
am:pm management.....
As I write this, I see I should introduce a “00:00…12:00”
variant (with 3 dots), which includes the 00:00, but ends
just before 12:00 (actually, is 12:00:00.000000000
am or pm ? I presume it is pm).
more, I need Time… actually I need to split events into morning /
afternoon events ( half day am:pm )
projects have half-day tasks only…
I found very useful the business_days gem, but nothing regarding