Question: Create a file called carbon.py , and write a function called get_current_day which takes in a single argument, an integer Unix timestamp (i.e. the number

Create a file called carbon.py, and write a function called get_current_day which takes in a single argument, an integer Unix timestamp (i.e. the number of seconds since Jan 01, 1970), and returns the corresponding day in UTC time (i.e. without considering any time zones or DST), in the format YYYY-MM-DD. We should be able to call the function without passing in any arguments, in which case, your function should return the time for the current timestamp.

Tips:

  1. You can get the current Unix timestamp by using the time function in the time module.
  2. The format listed is called ISO 8601 format. There are standard library functions which return the desired formatting, particularly in the datetime module. (You may be interested in the utcfromtimestamp() method in particular.)
  3. There are many utilities online which will do timestamp conversion, such as this one. You should make sure your answer is consistent with these utilities.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!