473,626 Members | 3,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

>time.strftim e %T missing in 2.3

Python 2.2/Unix
time.strftime ("%T") '22:12:15'time.strftime ("%X") '22:12:17'

Python 2.3/Windows
time.strftime ("%X") '22:12:47' time.strftime(" %T")

''

Any clues?

A.
Aug 5 '05 #1
4 2905
Andy Leszczynski wrote:
Python 2.2/Unix
>>time.strftime ("%T") '22:12:15' >>time.strftime ("%X") '22:12:17'

Python 2.3/Windows
>>time.strftime ("%X") '22:12:47' >> time.strftime(" %T") ''


From http://docs.python.org/lib/node252.html

"""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 I suggest that it's a platform issue, not a Python version issue. FWIW:

Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright" , "credits" or "license" for more information.
import time
time.strftime(" %T") '22:50:49' time.strftime(" %X")

'22:50:59'

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Aug 5 '05 #2
Robert Kern wrote:
Andy Leszczynski wrote:
Python 2.2/Unix
>>time.strftime ("%T")

'22:12:15'
>>time.strftime ("%X")

'22:12:17'

Python 2.3/Windows
>>time.strftime ("%X")

'22:12:47'
>> time.strftime(" %T")

''

From http://docs.python.org/lib/node252.html

"""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 I suggest that it's a platform issue, not a Python version issue. FWIW:

Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright" , "credits" or "license" for more information.
>>> import time
>>> time.strftime(" %T") '22:50:49' >>> time.strftime(" %X")

'22:50:59'


I accept that, but still pain. Took me a while to filter out the problem
in the code running on the Unix and not on M$.

A.
Aug 5 '05 #3
Andy Leszczynski wrote:
I accept that, but still pain. Took me a while to filter out the problem
in the code running on the Unix and not on M$.


This is one of the reasons I usually use Cygwin Python when I can. Stuff
is much less likely to mysteriously break when moving from UNIX to
Cygwin then from UNIX to Windows.
--
Michael Hoffman
Aug 5 '05 #4
On Fri, 05 Aug 2005 01:02:48 -0500, Andy Leszczynski <leszczynscyATn ospam.yahoo.com .nospam> wrote:
Robert Kern wrote:
Andy Leszczynski wrote:
Python 2.2/Unix

>>time.strftime ("%T")
'22:12:15'
>>time.strftime ("%X")
'22:12:17'

Python 2.3/Windows

>>time.strftime ("%X")
'22:12:47'
>> time.strftime(" %T")
''

From http://docs.python.org/lib/node252.html

"""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 I suggest that it's a platform issue, not a Python version issue. FWIW:

Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright" , "credits" or "license" for more information.
>>> import time
>>> time.strftime(" %T")

'22:50:49'
>>> time.strftime(" %X")

'22:50:59'


I accept that, but still pain. Took me a while to filter out the problem
in the code running on the Unix and not on M$.


I can imagine ...

By the way, you should probably /not/ change %T to %X.

%T (standardized in the Singe Unix Specification) is the same thing as ANSI
C %H:%M:%S which should be usable everywhere. %X on the other hand is "The
preferred time representation for the current locale without the date".
Not the same thing at all, for some users.

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Aug 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9306
by: John Hunter | last post by:
>>> from datetime import date >>> dt = date(1005,1,1) >>> print dt.strftime('%Y') Traceback (most recent call last): File "<stdin>", line 1, in ? ValueError: year=1005 is before 1900; the datetime strftime() methods require year >= 1900 Does anyone know of a datetime string formatter that can handles strftime format strings over the full range that datetime objects support?
822
29340
by: Turamnvia Suouriviaskimatta | last post by:
I 'm following various posting in "comp.lang.ada, comp.lang.c++ , comp.realtime, comp.software-eng" groups regarding selection of a programming language of C, C++ or Ada for safety critical real-time applications. The majority of expert/people recommend Ada for safety critical real-time applications. I've many years of experience in C/C++ (and Delphi) but no Ada knowledge. May I ask if it is too difficult to move from C/C++ to Ada?...
6
1814
by: Lorn | last post by:
I was hoping some of you might be able to help me understand the following code defining a typedef for a time query to the WINAPI. I understand the basics of what's going on, I just don't understand the format of the output it should provide. Here is the code below are some more comments: typedef struct tagGTime32 { union {
3
2250
by: Paul Janssen | last post by:
Hello! Can anyone help me out with the following situation: (a) a single query with 550 id's in the IN-clause resulting into 800+ seconds; (b) 550 queries with a single id in the IN-clause resulting into overall time of <60 seconds; The table consists of 950.000 records, and the resultset consists of 205.000 records.
14
1778
by: dananrg | last post by:
Been using the ODBC module for Python 2.1 (Win32) and had another question. When I return data from date columns, it's in a strange object form, e.g. <something or other> (don't have the output in front of me>. What's an easy way to convert date objects into a human-readable string? I'm using this module to extract data from an Oracle database, then converting it to a flat-file for import into an old flat-file database on a mainframe. I...
5
2647
by: John Nagle | last post by:
This, which is from a real web site, went into BeautifulSoup: <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer fantastic rates for selected weeks or days!!&blinkt=Click here And this came out, via prettify: <addresssnippet siteurl="http%3A//apartmentsapart.com" url="http%3A//www.apartmentsapart.com/Europe/Spain/Madrid/FAQ"> <param name="movie" value="/images/offersBanners/sw04.swf?binfot=We offer
56
5139
by: Zytan | last post by:
Obviously you can't just use a simple for loop, since you may skip over elements. You could modify the loop counter each time an element is deleted. But, the loop ending condition must be checked on each iteration, since the Count changes as you delete elements. I would think it is guaranteed to be computed each time, and not cached. So, is this the best way?
2
6120
by: Bruce Wood | last post by:
SortedList<Tgeneric has most of the methods of the old SortedList class, but it's missing a few, and one in particular that puzzles me. Anyone know why it has no GetByIndex method? It has IndexOfKey(), and IndexOfValue(), so you can ask it for indices into the list. You just can't do anything with them, because it has no method that takes an index and gives you back anything, neither an entry, nor a key, nor a value.
4
3357
by: jmcnamarw | last post by:
I keep getting: lr_strings.h (29): missing identifier lr_strings.h (59): missing identifier lr_strings.h (59): syntax error; found `0' expecting `;' lr_strings.h (59): unrecognized declaration lr_strings.h (59): unrecognized declaration lr_strings.h (60): unrecognized declaration lr_strings.h (60): warning: empty declaration c:\\documents and settings\\hmu7s5t\\local settings\\temp\\noname59\\\\combined_noname59.c (5): 6 errors, not...
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.