Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Vincent Zamora3,871 Points
def timestamp_oldest(*args): ts = list(args) ts.sort(reverse=True) return datetime.datetim
Why doesn't this work?
def timestamp_oldest(*args): ts = list(args) ts.sort(reverse=True) return datetime.datetime.fromtimestamp(ts.strftime('%Y-%m-%d %H:%M:%S'))
# If you need help, look up datetime.datetime.fromtimestamp() # Also, remember that you *will not* know how many timestamps # are coming in. import datetime def timestamp_oldest(*args): ts = list(args) ts.sort(reverse=True) return datetime.datetime.fromtimestamp(ts.strftime('%Y-%m-%d %H:%M:%S'))
Chris FreemanTreehouse Moderator 66,739 Points
Hey Vincent Zamora, you are VERY clsoe. Two items to correct:
- Since the "oldest" POSIX is the lowest, sorting will naturally put the oldest first. remove
- The method
datetime.datetime.fromtimestamptakes a POSIX format float by default. remove use of
strptimemethod (which does not exist on a
Post back if you need more help! Good luck!!
You're totally off track here, Vincent. I could give you some direction, do this;
1) Since the number of arguments is not known, create a
list and append all the arguments that will come in.
2) The challenge wants you to
return the oldest POSIX date, meaning the date closest to
1970, 01, 01, so if the
sort() method is used on a
sort() method will sort the values in the list from smallest to
greatest, so the smallest or oldest value will be the first value in the
3) Return the smallest value in the list by using
If you need help, msg me here.