-5

This is basically an algorithm:

  1. Load the date which is set in the system (Example: Tue Sep 24 21:44:01 2013)
  2. Add 24 days to the date above
  3. Print the date which we calculated in step 2.

Sorry if anyone doesn't understand, I will try to re explain if no one gets it.

Man16
  • 147
  • 1
  • 2
  • 10
  • 1
    Your example shows the date *and* time, not just the current day. – Martijn Pieters Sep 24 '13 at 20:48
  • 1
    What have you tried so far? Any number of trivial searches will reveal a solution for this problem, including no small number of [duplicates](http://stackoverflow.com/questions/546321/how-do-i-calculate-the-date-six-months-from-the-current-date-using-the-datetime) on this very site. – Henry Keiter Sep 24 '13 at 20:53
  • possible duplicate of [How to add hours to current time in python](http://stackoverflow.com/questions/13685201/how-to-add-hours-to-current-time-in-python) – Benjamin Leinweber Sep 24 '13 at 21:09

1 Answers1

8

Using the datetime module:

import datetime

today = datetime.date.today()
future = today + datetime.timedelta(days=24)
print future

Demo:

>>> import datetime
>>> today = datetime.date.today()
>>> future = today + datetime.timedelta(days=24)
>>> print future
2013-10-18

Adding the time is trivial; use datetime.datetime.now() instead of datetime.date.today().

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343