ASP + SQL Server + Time object problem

abramsjc at my-deja.com abramsjc at my-deja.com
Mon Jan 15 12:11:16 EST 2001


Hi again, thanks for the responses.
Here's what I came across. I should have specified that I import a module
and within a class in that module is where the problem was being
experienced. I read the docs by that genuis guy Mark, but trying to use
the PyTime objects gave me errors about no __float__ attribute and other
errors when trying different methods.

> To return a string formatted as the long date in control panel
> time.strftime("%#c", time.localtime(int(timeObject)))

See that int() conversion, that fails. What I found out that it was because
the code lied in the module. If I return the time object to the top-level ASP
script, the int conversion works, PyTime objects work, it all works.
But inside that imported module nothing worked. Pretty weird. Anyone
know why?



In article <93p88d013hg at news1.newsguy.com>,
  "Alex Martelli" <aleaxit at yahoo.com> wrote:
> "Tim Hammerquist" <tim at degree.ath.cx> wrote in message
> news:slrn95vghv.aqj.tim at degree.ath.cx...
>     [snip]
> > Anyone in the newsgroup familiar with the object model of a "time
> > object"?
>
> Hammond's docs included with win32all document it this way:
>
> PyTime Object
> A Python object, representing an instant in time.
>
> Comments
> A PyTime object is used primarily when exchanging date/time information with
> other COM objects.
> Using int(timeObject) will return an integer compatible with the time
> module.
>
> Example
> To return a simple string
> time.ctime(int(timeObject))
>
> To return a string formatted as the long date in control panel
> time.strftime("%#c", time.localtime(int(timeObject)))
>
> See Also
> pywintypes::Time
>
> Methods
> Format
> Formats the time value
> __int__
> Used when an integer representation of the time object is required.
> __float__
> Used when a floating point representation of the time object is required.
> __print__
> Used when the time object is printed. tp_print
> __cmp__
> Used when time objects are compared. tp_compare
> __hash__
> Used when the hash value of an time object is required tp_hash
>
> Seems pretty good to me -- what's missing?
>
> Alex
>
>


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list