Now I have:

        self.env.log.debug('utimestamp tests')
        ds = '2012-02-01'
        try:
            self.env.log.debug('a. ds:%s' % ds)
            d = datetime.strptime(ds, '%Y-%m-%d')
            self.env.log.debug('b. d:%s' % d)
            d = d.replace(hour=0, minute=0, second=0, microsecond=0)
            d = d.replace(tzinfo=localtz)
            self.env.log.debug('c. d:%s' % d)
            d = to_datetime(d)
            self.env.log.debug('d. d:%s' % d)
            uts = to_utimestamp(d)
            self.env.log.debug('1. ds:%s -> uts:%s' % (ds, uts))
        except:
            self.env.log.debug('My way failed')


which produces:

2012-09-18 14:49:09,988 Trac[tracpm] DEBUG: utimestamp tests
2012-09-18 14:49:09,988 Trac[tracpm] DEBUG: a. ds:2012-02-01
2012-09-18 14:49:09,990 Trac[tracpm] DEBUG: b. d:2012-02-01 00:00:00
2012-09-18 14:49:09,990 Trac[tracpm] DEBUG: c. d:2012-02-01 00:00:00-05:00
2012-09-18 14:49:09,990 Trac[tracpm] DEBUG: d. d:2012-02-01 00:00:00-05:00
2012-09-18 14:49:09,991 Trac[tracpm] DEBUG: 1. ds:2012-02-01 ->
uts:1328072400000000
2012-09-18 14:49:09,992 Trac[tracpm] DEBUG: 2. ds:2012-02-01 ->
uts:1328072400000000

But I'm not sure how portable that is beyond 0.11.

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to trac-dev@googlegroups.com.
To unsubscribe from this group, send email to 
trac-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to