Re: simpler increment of time values?

Discussion in 'Python' started by Chris Angelico, Jul 5, 2012.

  1. On Thu, Jul 5, 2012 at 10:29 AM, Vlastimil Brom
    <> wrote:
    > I'd like to ask about the possibilities to do some basic manipulation
    > on timestamps - such as incrementing a given time (hour.minute -
    > string) by some minutes.
    > Very basic notion of "time" is assumed, i.e. dateless,
    > timezone-unaware, DST-less etc.


    My first suggestion would be to work with Unix times (that is, store
    your time as "seconds since 1970", also called a time_t). That's
    forced to be on UTC (but ignoring leap seconds) so you don't have to
    worry about timezones or DST, and incrementing by X minutes is simply
    adding X*60 to it. It makes your job a lot easier!

    ChrisA
     
    Chris Angelico, Jul 5, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vlastimil Brom

    simpler increment of time values?

    Vlastimil Brom, Jul 5, 2012, in forum: Python
    Replies:
    5
    Views:
    239
    Steven D'Aprano
    Jul 6, 2012
  2. Mark Lawrence

    Re: simpler increment of time values?

    Mark Lawrence, Jul 5, 2012, in forum: Python
    Replies:
    0
    Views:
    183
    Mark Lawrence
    Jul 5, 2012
  3. Jason Friedman

    Re: simpler increment of time values?

    Jason Friedman, Jul 5, 2012, in forum: Python
    Replies:
    0
    Views:
    166
    Jason Friedman
    Jul 5, 2012
  4. Devin Jeanpierre

    Re: simpler increment of time values?

    Devin Jeanpierre, Jul 5, 2012, in forum: Python
    Replies:
    0
    Views:
    198
    Devin Jeanpierre
    Jul 5, 2012
  5. Vlastimil Brom

    Re: simpler increment of time values?

    Vlastimil Brom, Jul 5, 2012, in forum: Python
    Replies:
    0
    Views:
    172
    Vlastimil Brom
    Jul 5, 2012
Loading...

Share This Page