Re: Why %e not in time.strftime directives?

2008-12-14 Thread Tim Chase

Any special reasons?

Because it is there (at least on my Debian box)?


But not on windows :(

import time
time.strftime(%e)

''


Guess you'll have to take it up with the authors of strftime() at 
Microsoft :)



 The full set of format codes supported varies across
 platforms, because Python calls the platform C library's
 strftime() function, and platform variations are common.

So if your underlying C implementation of strftime() supports %e, then
Python will.  My guess is that the same applies to time.strftime as it does
to datetime.strftime

The docs list ones that are fairly cross-platform.  However, it would seem
that not all platforms support %e


If you don't have any luck convincing Microsoft to add %e to 
their strftime implementation, you can use


  strftime('%d').lstrip('0').rjust(2)

to replicate the desired behavior :)

-tkc



--
http://mail.python.org/mailman/listinfo/python-list


Re: Why %e not in time.strftime directives?

2008-12-13 Thread skip

Leo Any special reasons?

Nobody thought to add it?  Got a patch?

-- 
Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why %e not in time.strftime directives?

2008-12-13 Thread Tim Chase

Any special reasons?


Because it is there (at least on my Debian box)?

  t...@rubbish:~$ python
  Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
  [GCC 4.2.4 (Debian 4.2.4-1)] on linux2
  Type help, copyright, credits or license for
  more information.

   import time
   time.strftime('%c')
  'Sat Dec 13 09:35:03 2008'
   time.strftime('%e')
  '13'

Taken from[1]

  The full set of format codes supported varies across
  platforms, because Python calls the platform C library's
  strftime() function, and platform variations are common.

So if your underlying C implementation of strftime() supports 
%e, then Python will.  My guess is that the same applies to 
time.strftime as it does to datetime.strftime


The docs list ones that are fairly cross-platform.  However, it 
would seem that not all platforms support %e



-tkc


[1]
http://docs.python.org/library/datetime.html#module-datetime




--
http://mail.python.org/mailman/listinfo/python-list


Re: Why %e not in time.strftime directives?

2008-12-13 Thread Leo Jay
On Sat, Dec 13, 2008 at 11:50 PM, Tim Chase
python.l...@tim.thechases.com wrote:
 Any special reasons?

 Because it is there (at least on my Debian box)?



But not on windows :(
 import time
 time.strftime(%e)
''



  t...@rubbish:~$ python
  Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
  [GCC 4.2.4 (Debian 4.2.4-1)] on linux2
  Type help, copyright, credits or license for
  more information.

   import time
   time.strftime('%c')
  'Sat Dec 13 09:35:03 2008'
   time.strftime('%e')
  '13'

 Taken from[1]

  The full set of format codes supported varies across
  platforms, because Python calls the platform C library's
  strftime() function, and platform variations are common.

 So if your underlying C implementation of strftime() supports %e, then
 Python will.  My guess is that the same applies to time.strftime as it does
 to datetime.strftime

 The docs list ones that are fairly cross-platform.  However, it would seem
 that not all platforms support %e


 -tkc


 [1]
 http://docs.python.org/library/datetime.html#module-datetime




-- 
Best Regards,
Leo Jay
--
http://mail.python.org/mailman/listinfo/python-list