View Problem

Display information about a date

Display the day of month, day of year, month name and day name of the day 8 days from now.
DiskEdit
python
from datetime import datetime, timedelta

eightDaysFromNow = datetime.now() + timedelta(days=8)

print eightDaysFromNow.strftime('%d') # day of month
print eightDaysFromNow.strftime('%j') # day of year
print eightDaysFromNow.strftime('%B') # month name FULL
print eightDaysFromNow.strftime('%A') # day of week name FULL
ExpandDiskEdit
clojure
(let [cal (Calendar/getInstance)]
(.add cal Calendar/DAY_OF_YEAR 8)
(println (.format (SimpleDateFormat. "d, D, MMMM, EEEE")
(.getTime cal))))
ExpandDiskEdit
cpp Qt 4.x
QDate dateEightDaysFromNow = QDate::currentDate().addDays(8);
DiskEdit
fsharp
Using F# interactive

> let Then = DateTime.Now.AddDays(8.0)
- let dayNumber = Then.DayOfYear.ToString()
- let solution = Then.ToString("dd " + dayNumber + " MMMM dddd");;

val Then : DateTime = 08/08/2010 08:58:05
val dayNumber : string = "220"
val solution : string = "08 220 August Sunday"

>

Submit a new solution for python, erlang, clojure, cpp ...
There are 12 other solutions in additional languages (csharp, fantom, go, groovy ...)