You've gotten some really excellent advice about how to approach working
with the time format.  Here's a chunk of code I use quite a bit.  It's
probably sub-optimal, but playing with it might help you come up with a
solution that works for your application.


 def Int2Digit(integer):
    if integer < 9:
        strInteger = "0"+str(integer)
    else:
        strInteger = str(integer)
    return strInteger

def TimeStampMaker():
    import datetime
    t = datetime.datetime.now()
    strTmonth = Int2Digit(t.month)
    strTday = Int2Digit(t.day)
    strThour = Int2Digit(t.hour)
    strTminute = Int2Digit(t.minute)
    timeStamp = str(t.year)+strTmonth+strTday+strThour+strTminute
    return timeStamp

Good Luck -  D
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to