Issue with continous incrementing of unbroken sequence for a entire working day

Chris Angelico rosuav at gmail.com
Fri Mar 1 08:59:16 CET 2013


On Fri, Mar 1, 2013 at 6:50 PM, Morten Engvoldsen <mortenengv at gmail.com> wrote:
> Hi,
> No i don't want user to blame when date is changed and serial number
> reset when it should not. Do you think the following function will
> help for this:
>
> import datetime as dt
>>>> import pytz
>>>> utc = pytz.timezone("UTC")
>>>> norway = pytz.timezone("Europe/Norway")
>>>> a = dt.datetime(2008, 7, 6, 5, 4, 3, tzinfo=utc)
>>>> b = a.astimezone(norway)
>
> Your suggestion is really appreciated..

(posting reply on-list, hope that's okay!)

That would be fine for the normal case. It's just possible that the
user will change the computer's clock, which would result in the
serial changing oddly. If that's not a problem to you, the job's done!

ChrisA



More information about the Python-list mailing list