0

I have searched and searched but can't seem to figure it out. So I was wondering if someone can help with me to get the current Time as well as time 00:00:00. I would like to achieve the following.

int cnt = 0;
if ( time_now = "00:00:00" ) {
 cnt = 0;
}
else {
 cnt = 1;
}

Thanks

  • https://stackoverflow.com/a/20648756/5746918 – Ishita Sinha Feb 14 '18 at 08:16
  • Possible duplicate of [How do I compare strings in Java?](https://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java) – Ole V.V. Feb 14 '18 at 10:48
  • @IshitaSinha The answer you are linking to is using the long outdated and notoriously troublesome `SimpleDateFormat` class. Please don’t teach the young ones that. [The answer by Basil Bourque](https://stackoverflow.com/a/36168941/5772882) is modern and IMHO better. – Ole V.V. Feb 14 '18 at 10:51
  • `if (LocalTime.now(ZoneId.of("Africa/Johannesburg").truncatedTo(ChronoUnit.SECONDS)) .equals(LocalTime.MIN))` … – Ole V.V. Feb 14 '18 at 10:54

0 Answers0