1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
miskamm [114]
3 years ago
15

Write a program that estimates how many years, months, weeks, days, and hours have gone by since Jan 1 1970 by calculations with

the number of seconds that have passed.
Computers and Technology
1 answer:
Rzqust [24]3 years ago
6 0

Answer:

Explanation:

The following code is written in Java. It uses the LocalDate import to get the number of seconds since the epoch (Jan 1, 1970) and then uses the ChronoUnit import class to transform those seconds into years, months, weeks days, and hours. Finally, printing out each value separately to the console. The output of the code can be seen in the attached picture below.

import java.time.LocalDate;

import java.time.temporal.ChronoUnit;

class Brainly {

   public static void main(String[] args) {

       LocalDate now = LocalDate.now();

       LocalDate epoch = LocalDate.ofEpochDay(0);

       System.out.println("Time since Jan 1 1970");

       System.out.println("Years: " + ChronoUnit.YEARS.between(epoch, now));

       System.out.println("Months: " + ChronoUnit.MONTHS.between(epoch, now));

       System.out.println("Weeks: " + ChronoUnit.WEEKS.between(epoch, now));

       System.out.println("Days: " + ChronoUnit.DAYS.between(epoch, now));

       System.out.println("Hours: " + (ChronoUnit.DAYS.between(epoch, now) * 24));    

   }

}

You might be interested in
Which of the following software program provides for email communication
olga2289 [7]
If "Outlook" is one of the options then thats the answer.
6 0
4 years ago
Read 2 more answers
Explain 3 ways you can be an upstander when seeing cyberbullying.
Bess [88]

Answer:

Assuming an upstander is someone that opposes cyberbullying:

(1) Call them out

(2) Report the behavior to proper moderation authority

(3) Tell the person to block messages from the cyberbully

I don't really know what else you want from this.

Cheers.

3 0
3 years ago
Read 2 more answers
How does a typewriter involve math and science?
patriot [66]
You have a specific number of words typed a minute and you need to know the science involved in making it
8 0
3 years ago
Read 2 more answers
When you write contracts, should you list many definitions at the start of the document?
aev [14]

Answer:

You can.

Explanation:

If you want you can, but usually as you cover topics you should list the definitions for each topic then instead of all at the beginning you do not want it to seem like it is a lot.  

4 0
3 years ago
If you must use a credit card while in college what are some ways you can keep from getting in credit card debt?
marin [14]

Answer:

Pay attention to what you buy and limit yourself to an amount of money everyday.

Explanation:

This is just a simple way from spending a lot and limits your everyday spendings when you actually leave an amount for yourself.

3 0
4 years ago
Other questions:
  • Mathematical computations by a computer are faster than your quickest mathematical computations because the top speed of a neura
    13·1 answer
  • ____ are the computers that store network software and shared or private user files.
    6·1 answer
  • After compiling source code, which command still needs to be run in order to copy the newly compiled binaries into a directory l
    5·1 answer
  • Information is best described as
    10·1 answer
  • Which of the following browsers was introduced with windows 10?
    10·1 answer
  • Which letter would appear in the third position of the standard wheel marking of a hard-grade wheel?
    10·2 answers
  • Explain the following terms <br><br>copyleft:<br><br>creative Commons:<br><br>GNU/GPL:​
    8·1 answer
  • Please help I’m not trying to fail
    7·2 answers
  • Explain how mobile phone production could be more sustainable​
    8·2 answers
  • Most spyware programs are benign in that they do not perform malicious acts or steal data. group of answer choices true false
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!