Here is the code that returns what you need:
ZonedDateTime localNow = Instant.now().atZone(ZoneOffset.systemDefault()); ZonedDateTime localAtCristsBirth = Instant.parse("0001-01-01T00:00:00.00Z").atZone(ZoneOffset.systemDefault()); Duration timePassed = Duration.between(localAtCristsBirth, localNow); System.out.format("От тождества Христова прошло %d секунд\n", timePassed.getSeconds() );
Clarification in response to clarification in the question:
In fact, the code you 0001.01.01 00:00 does not take into account time zones, that is, it converts the number of seconds elapsed from the time 0001.01.01 00:00 local time (no matter which one) to the date of the same local time. If this is called the number of seconds "from the birth of Christ", then this code can be considered correct only in the time zone in which Jesus was born. Here is the code that receives the Timestamp (since you really want to, although I don’t understand why you need a Date or a "more correct" Timestamp ) and returns exactly what you need (number of seconds from 00:00 01.01.01 local time as a string):
package stackoverflow; import java.sql.Timestamp; import java.time.Duration; import java.time.LocalDateTime; import java.time.Month; import java.time.ZoneId; public class Ru_so_941590 { public static void main(String[] args) { Timestamp now = Timestamp.valueOf(LocalDateTime.now()); say("Местное время: " + now); String secondsAD_str = secsWouldHavePassedSinceChtistsBirthIfHeHadBeenBornHere(now); System.out.format("Если бы Спаситель родился здесь, " + "то с момента его рождения прошло бы\n\t\t %,d секунд\n", Long.parseLong(secondsAD_str) ); say("Converted back: " + dateStrFromSecondsAD(secondsAD_str)); } private static String secsWouldHavePassedSinceChtistsBirthIfHeHadBeenBornHere(Timestamp now) { LocalDateTime nowLocal = LocalDateTime.ofInstant(now.toInstant(), ZoneId.systemDefault()); LocalDateTime christsBirthday = LocalDateTime.parse("0001-01-01T00:00:00"); return String.valueOf(Duration.between(christsBirthday, nowLocal).getSeconds()); } private static String dateStrFromSecondsAD(String secondStr) { LocalDateTime christsBirth = LocalDateTime.of(1, Month.JANUARY, 1, 0, 0, 0); LocalDateTime resDate = christsBirth.plusSeconds(Long.parseLong(secondStr)); return String.valueOf(resDate); } static void say(String format, Object... args) { System.out.println(String.format(format, args)); } static void say(String s) { System.out.println(s); } }