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]
2 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]2 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
In regard to segmentation, all of the following are examples of a customer's behavior or relationship with a product EXCEPT: a)
scZoUnD [109]

Answer: demographics

Explanation:

Market segmentation refers to the process of dividing the consumers into sub-groups of consumers which are refered to as the segments based on the characteristics shared.

The examples of a customer's behavior or relationship with a product include user status, usage rate and loyalty status.

It should be noted that some examples of market segmentation are behavioral, demographic, geographic, and psychographic. From the options given, demographics is not an example of a customer's behavior with a product.

7 0
2 years ago
If given the chance to own manage a business,what will be the name of the business?
Nady [450]
This is honestly an answer you can give. What would you name a business if you made one?
7 0
3 years ago
Read 2 more answers
If you Buy my group clothing in R.o.b.l.o.x for a donation i will make you brainliest
erastova [34]

Answer:kk ima do it

Explanation:

7 0
3 years ago
Read 2 more answers
A friend emails a presentation to isabella to view. what kind of change can she make?​
fiasKO [112]

Answer:

She can enable editing. She can change the view.

Explanation:

6 0
2 years ago
The random module is a group of functions that are used to deal with random numbers.
maksim [4K]
True because it is the
5 0
2 years ago
Read 2 more answers
Other questions:
  • kai is interviewing for a job, and the interviewer asks him for an example of skill at cooperating with others. Which example be
    14·2 answers
  • Prompt the user for a string that contains two strings separated by a comma. (1 pt)Examples of strings that can be accepted:Jill
    5·1 answer
  • The ________ occurs when the user presses the enter key without typing a value for an input operation.
    5·1 answer
  • What is a googleplex?
    7·1 answer
  • 4. Write an appropriate comment for describ-
    11·1 answer
  • The method main of a class is called when you instantiate an object of that class like this: Box myBox = new Box();
    9·1 answer
  • What type of device is the keyboard?<br><br> Output<br> Input<br> Monitoring<br> Software
    7·2 answers
  • A list of sources used for in-text citations that appears at the end of a document is called:
    10·1 answer
  • What are the main types of database end users,? Discuss the main activi-ties of each
    10·1 answer
  • What does syntax error mean :-;<br>explain briefly.<br><br>thankyou!
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!