Basic date/time question

I’m trying to calculate a period of time; basically each month is
divided in 2 periods, from the 1st of the month to the 15th is period1,
and from the 16th to the last day of the month is period2…

Now my problem is that…I’m not sure if midnight (00:00:00) is
considered the "end " of the current day, or the “start” of the next
day…

So for example; is December 15th, midnight (00:00:00) considered the
very start of December 15th, or the very end of it?

Basically, I’m not sure as to where a “day” starts and ends?
(ex: from 00:00:00 to 11:59:59? or from 00:00:01 to 00:00:00 etc…)

Any help would be appreciated… I know it might sound a bit confusing, I
can try to explain it better…

On Dec 19, 2007, at 4:28 PM, Jean-nicolas Jolivet wrote:

very start of December 15th, or the very end of it?

Basically, I’m not sure as to where a “day” starts and ends?
(ex: from 00:00:00 to 11:59:59? or from 00:00:01 to 00:00:00 etc…)

Any help would be appreciated… I know it might sound a bit
confusing, I
can try to explain it better…

Midnight is the START of the day.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Gotcha, so basically, using December as an example, the period1 would
be:
From: December 1, 00:00:00 (midnight)
To: December 15, 11:59:59

and Period2:
From: December 16th 00:00:00 (midnight)
To: December 31st 11:59:59

right? Just want to make sure I’m not “missing a second”…

Rob B. wrote:

On Dec 19, 2007, at 4:28 PM, Jean-nicolas Jolivet wrote:

Midnight is the START of the day.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Rob B. wrote:

Or (after converting the strings to real Time objects):

period1 = (“December 1, 00:00:00”…“December 16, 00:00:00”)

period2 = (“December 16, 00:00:00”…“January 1, 00:00:00”)

Note the end-excluding three-dot Range constructor.

This way of thinking works with Date or Time and means that for any
given date in December, only one of these can be true:

period1.include?(given)
period2.include?(given)

-Rob

Great… makes more sense that way! Thank you :slight_smile:

Or (after converting the strings to real Time objects):

period1 = (“December 1, 00:00:00”…“December 16, 00:00:00”)

period2 = (“December 16, 00:00:00”…“January 1, 00:00:00”)

Note the end-excluding three-dot Range constructor.

This way of thinking works with Date or Time and means that for any
given date in December, only one of these can be true:

period1.include?(given)
period2.include?(given)

-Rob