pastebin

Paste Search Dynamic
Recent pastes
ZonedDateTime
  1. /* package whatever; // don't place package name! */
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5. import java.time.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. public class Main
  9. {
  10.         public static void main (string[] args)
  11.         {
  12.                 ZonedDateTime startOfToday = LocalDate.now().atStartOfDay(ZoneId.systemDefault());
  13.         long localDate = startOfToday.toEpochSecond() * 1000;
  14.  
  15.                 calendar cal = calendar.getInstance();
  16.                 int year  = cal.get(calendar.YEAR);
  17.                 int month = cal.get(calendar.MONTH);
  18.                 int date  = cal.get(calendar.DATE);
  19.                 cal.clear();
  20.                 cal.set(year, month, date);
  21.                 long todayMillis2 = cal.getTimeInMillis();
  22.                 system.out.println(localDate);
  23.                 system.out.println(todayMillis2);
  24.         }
  25. }
Parsed in 0.022 seconds