Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: This function must have the following header: def my_datetime(num_sec). This function takes in an integer value that represents the number of seconds since the

Python:

This function must have the following header: def my_datetime(num_sec). This function takes in an integer value that represents the number of seconds since the epoch: January 1st 1970. The function takes num_sec and converts it to a date and returns it as a string with the following format: MM-DD-YYYY. It has the following specifications:

  • It may be assumed that num_sec will always be an int value
  • It may be assumed that num_sec will always be a non-negative value
  • Must be able to handle leap years

Some examples:

  • my_datetime(0) returns 01-01-1970
  • my_datetime(123456789) returns 11-29-1973
  • my_datetime(9876543210) returns 12-22-2282
  • my_datetime(201653971200) returns 02-29-8360

Your function handle all the computation itself. You are not permitted to use any library that can convert seconds to a date. This includes, but is not limitted to:

  • datetime
  • arrow
  • moment
  • maya
  • delorean
  • freezegun

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago