From: Dr J R Stockton on
In comp.lang.java.programmer message <4b9a6a55$0$668$426a74cc(a)news.free.
fr>, Fri, 12 Mar 2010 16:22:45, Thomas Pornin <pornin(a)bolet.org> posted:
>According to laredotornado <laredotornado(a)zipmail.com>:
>> I'm using Java 1.5. I have a java.util.Date object and I would like
>> to determine if it's date (i.e. year, month, and day) are greater than
>> (in the future) or equal to today's date (year, month, and day).
>> However, I don't care about any time component (hour, minute,
>> second ...) when the comparison is taking place. What is the easiest
>> way I can determine this?
>
>If you are in the UTC time zone (often called GMT too), then this
>is simple.

As I recall, only the ISS, Iceland, and a few countries around Liberia
use GMT year-round. The corresponding time zone is considerably larger,
including the British Isles and Portugal. Time Zones do not routinely
change in Spring and Autumn.


In comp.lang.java.programmer message <hndssc$mip$1(a)south.jnrs.ja.net>,
Fri, 12 Mar 2010 17:15:56, Nigel Wade <nmw(a)ion.le.ac.uk> posted:

>Consider the two instants in time 1 minute before midnight GMT and 1
>minute after midnight GMT. They belong to different days in London, but
>are both in the same day in New York (or any other timezone for that
>matter).

They are not different days in Summer in the British Isles.
They are different days in Summer in lands in the next zone West (small
Atlantic islands).



In comp.lang.java.programmer message <9ahmp5de690kdeodkvdjenjncv78l0tlt1
@4ax.com>, Sat, 13 Mar 2010 03:01:10, George Neuner
<gneuner2(a)comcast.net> posted:
>
>Undoubtedly it quickly evolved into a business issue, but I thought
>the original use was wartime fuel conservation. AFAIK, WWI Germany
>was the first country to use daylight saving - to save coal.

But not the first nationality. British first used it on 1915-09-26,
Germany not till the end of the following April. Sundry Canadian
localities used it in the preceding decade.


--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
From: Arne Vajhøj on
On 12-03-2010 11:12, laredotornado wrote:
> I'm using Java 1.5. I have a java.util.Date object and I would like
> to determine if it's date (i.e. year, month, and day) are greater than
> (in the future) or equal to today's date (year, month, and day).
> However, I don't care about any time component (hour, minute,
> second ...) when the comparison is taking place. What is the easiest
> way I can determine this?

There must be several ways.

My suggestion:

public static boolean isFutureDay(Date d) {
Calendar cal = Calendar.getInstance();
cal.setTime(d);
Calendar fut = Calendar.getInstance();
fut.add(Calendar.DATE, 1);
fut.set(Calendar.HOUR_OF_DAY, 0);
fut.set(Calendar.MINUTE, 0);
fut.set(Calendar.SECOND, 0);
fut.set(Calendar.MILLISECOND, 0);
return cal.compareTo(fut) >= 0;
}

Arne
From: Nigel Wade on
On Sun, 14 Mar 2010 18:40:08 +0000, Dr J R Stockton wrote:

>
> In comp.lang.java.programmer message <hndssc$mip$1(a)south.jnrs.ja.net>,
> Fri, 12 Mar 2010 17:15:56, Nigel Wade <nmw(a)ion.le.ac.uk> posted:
>
>>Consider the two instants in time 1 minute before midnight GMT and 1
>>minute after midnight GMT. They belong to different days in London, but
>>are both in the same day in New York (or any other timezone for that
>>matter).
>
> They are not different days in Summer in the British Isles. They are
> different days in Summer in lands in the next zone West (small Atlantic
> islands).
>

Then London would be in BST, not GMT, and under the inclusion of "any
other timezone".

--
Nigel Wade
From: RedGrittyBrick on
On 15/03/2010 09:35, Nigel Wade wrote:
> On Sun, 14 Mar 2010 18:40:08 +0000, Dr J R Stockton wrote:
>
>>
>> In comp.lang.java.programmer message<hndssc$mip$1(a)south.jnrs.ja.net>,
>> Fri, 12 Mar 2010 17:15:56, Nigel Wade<nmw(a)ion.le.ac.uk> posted:
>>
>>> Consider the two instants in time 1 minute before midnight GMT and 1
>>> minute after midnight GMT. They belong to different days in London, but
>>> are both in the same day in New York (or any other timezone for that
>>> matter).
>>
>> They are not different days in Summer in the British Isles. They are
>> different days in Summer in lands in the next zone West (small Atlantic
>> islands).
>>
>
> Then London would be in BST, not GMT, and under the inclusion of "any
> other timezone".
>

IIRC Dr John Stockton has previously pointed out that BST is not a timezone.

Perhaps because of the terminology used in Unix, I have previously
conflated the ideas of clock shifts such as summer time (or DST) with
the geographic regions known as time-zones.

--
RGB
From: Dr J R Stockton on
In comp.lang.java.programmer message <hnkv1g$mip$2(a)south.jnrs.ja.net>,
Mon, 15 Mar 2010 09:35:44, Nigel Wade <nmw(a)ion.le.ac.uk> posted:
>On Sun, 14 Mar 2010 18:40:08 +0000, Dr J R Stockton wrote:
>> In comp.lang.java.programmer message <hndssc$mip$1(a)south.jnrs.ja.net>,
>> Fri, 12 Mar 2010 17:15:56, Nigel Wade <nmw(a)ion.le.ac.uk> posted:
>>
>>>Consider the two instants in time 1 minute before midnight GMT and 1
>>>minute after midnight GMT. They belong to different days in London, but
>>>are both in the same day in New York (or any other timezone for that
>>>matter).
>>
>> They are not different days in Summer in the British Isles. They are
>> different days in Summer in lands in the next zone West (small Atlantic
>> islands).
>>
>
>Then London would be in BST, not GMT, and under the inclusion of "any
>other timezone".

The marking of a time with GMT or UTC does not mean that the local time
is GMT or UTC. Listen to the BBC World Service at midnights after
2010-03-28T12:00.

Without a change in rules, London is in the "GMT" time zone all year
round. Time zones do not move seasonally. Time Zone gives Winter Time,
and there is an additional offset in many temperate regions, of a half
or one hour, in the Summer half of the year.

Do not confuse time zone with civil time offset; that is a habit
invented by ill-educated Americans, probably in California.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
First  |  Prev  | 
Pages: 1 2 3 4
Prev: Open popup from JSP - Servlet ??
Next: XPath question.