Dustan <[EMAIL PROTECTED]> wrote: > Is it possible to get the system date on a Windows XP machine? Most > Convenient would to retrieve YYYY, MM, and DD as seperate variables. > > When I say system date, I'm thinking of the small clock in the > lower-right hand corner, which has date as well as time, but if there's > another clock that Python supports, it works for me as long as it's > somewhat accurate.
>>> import datetime >>> x=datetime.date.today() >>> yyyy, mm, dd = x.year, x.month, x.day >>> print yyyy 2006 >>> print mm 2 >>> print dd 5 >>> As you see, these are integers (so, for example, mm is not '02' but just 2). Pretty easy to make them into strings, of course, if you want. Alex -- http://mail.python.org/mailman/listinfo/python-list