If I were to run the following code:
import datetime
dt = datetime.datetime.now()
date_str = dt.ctime()
Will the result of len(date_str) always be the same, regardless of when I happen to run the code? I think it will be, but I'm not certain. I looked at the datetime module reference but the relevant section says:
Return a string representing the date:
>>> from datetime import date >>> date(2002, 12, 4).ctime() 'Wed Dec 4 00:00:00 2002'
d.ctime()is equivalent to:time.ctime(time.mktime(d.timetuple()))on platforms where the native C ctime() function (which time.ctime() invokes, but which date.ctime() does not invoke) conforms to the C standard.
But looking at the article on cppreference.com, the answer is less than clear to me. I did find a reference here which suggests that it will be a 24-character wide string, but I was hoping for a more official source or reference if possible. It's possible that I didn't delve far enough into the C-standard to divine the answer.
Also, based on that quote, does that mean the behavior might be platform-dependent? Or is it likely to be generally uniform outside of niche operating systems?
(yes I know that I can manually format to fixed-width, but I want to know whether the built-in one already is that way)