0

I have a ZonedDateTime instance namely say zonedDateTime for Europe/Berlin which is currently observing DST of an hour.

How do i know this instance observesDaylightTime or not : boolean value programmatically?
If it is then how much dst time applied currently in seconds? in this case it is one hour for berlin

I have tried below but no luck.

zonedDateTime.getOffset.getRules.isDaylightSavings(java.time.Instant.now())
zonedDateTime.getOffset.getRules.isDaylightSavings(zonedDateTime.toInstant())

It will be great if you can answer all TimeZone and SimpleTimeZone class methods and its equivalent in java8 time package.

Note: i have not asked for class comparision, I told methods. e.g. TimeZone has getDisplayName() which is equivalent in java 8 like below

DateTimeFormatter.ofPattern("zzz").format(ZonedDateTime)   // for short 
DateTimeFormatter.ofPattern("zzzzz").format(ZonedDateTime) // for long

But above is good to have.

Kanagavelu Sugumar
  • 16,614
  • 19
  • 77
  • 92
  • I have not asked Java8 time package take care of DST or not. I want a code from how to ensure my dst is currently observed on zonedDateTime or not? Also how much? I dont any such code in that duplicate link – Kanagavelu Sugumar Oct 05 '20 at 07:49
  • @Arvind Kumar Avinash Please read the question, before you close. Can you point out the the exact answer from the duplicate you mentioned above? – Kanagavelu Sugumar Oct 05 '20 at 07:58
  • Kanagavelu Sugumar - After making two edits, you are blaming me that I did not read the question. The question I have used to mark this as duplicate answers even your edited question. Just try it and if you still face the issue, we are here to help you. – Arvind Kumar Avinash Oct 05 '20 at 08:07
  • @ArvindKumarAvinash There is no deletion what ever initially added, added some of code observation and responding to one my answer i got. Reopen/else point me the duplicate which has answer. I dont know what makes you hurry closing it? – Kanagavelu Sugumar Oct 05 '20 at 08:10
  • 1
    Kanagavelu Sugumar - You should be happy that your original question was closed as duplicate; otherwise, as per SO guidelines, your original question should have been closed for the reasons like `Needs more focus` or `Needs details or clarity.` My question to you is: have you tried the solutions given in that question? – Arvind Kumar Avinash Oct 05 '20 at 08:32

0 Answers0