Dennis Lee Bieber writes:
> On Tue, 19 Apr 2022 15:51:09 +0200, "Loris Bennett"
> declaimed the following:
>
>>If I am merely trying to represent part a very large number of seconds
>>as a number of years, 365 days per year does not seem that controversial
>
> The Explanatory Supplement
Random832 writes:
> On Tue, Apr 19, 2022, at 07:11, Loris Bennett wrote:
>> I now realise that timedelta is not really what I need. I am
>> interested solely in pure periods, i.e. numbers of seconds, that I
>> can convert back and forth from a format such as
>
> A timedelta *is* a pure period.
On Tue, Apr 19, 2022, at 07:11, Loris Bennett wrote:
> I now realise that timedelta is not really what I need. I am interested
> solely in pure periods, i.e. numbers of seconds, that I can convert back
> and forth from a format such as
A timedelta *is* a pure period. A timedelta of one day is
On 2022-04-19, Barry wrote:
>> On 19 Apr 2022, at 19:38, Dennis Lee Bieber wrote:
>> *I /think/ this is the year used for leap-day calculations, and
>> why some leap centuries are skipped as it is really less than a
>> quarter day per year, so eventually one gets to over-correcting
> On 19 Apr 2022, at 19:38, Dennis Lee Bieber wrote:
>
> *I /think/ this is the year used for leap-day calculations, and why some
> leap centuries are skipped as it is really less than a quarter day per
> year, so eventually one gets to over-correcting by a day.
Leap century is skip
On 2022-04-19 19:23, Dennis Lee Bieber wrote:
On Tue, 19 Apr 2022 15:51:09 +0200, "Loris Bennett"
declaimed the following:
If I am merely trying to represent part a very large number of seconds
as a number of years, 365 days per year does not seem that controversial
The Explanatory
On Tue, 19 Apr 2022 15:51:09 +0200, "Loris Bennett"
declaimed the following:
>If I am merely trying to represent part a very large number of seconds
>as a number of years, 365 days per year does not seem that controversial
The Explanatory Supplement to the Astronomical Almanac (table
On Wed, 20 Apr 2022 at 02:16, Loris Bennett wrote:
> I now realise that timedelta is not really what I need. I am interested
> solely in pure periods, i.e. numbers of seconds, that I can convert back
> and forth from a format such as
>
> 11-22::44:55
>
> (These are the lengths of time a job
Jon Ribbens writes:
> On 2022-04-19, Loris Bennett wrote:
>> If I am merely trying to represent part a very large number of seconds
>> as a number of years, 365 days per year does not seem that controversial
>> to me. Obviously there are issues if you expect all periods of an
>> integer number
On 2022-04-19, Loris Bennett wrote:
> If I am merely trying to represent part a very large number of seconds
> as a number of years, 365 days per year does not seem that controversial
> to me. Obviously there are issues if you expect all periods of an
> integer number of years which start on a
On 2022-04-19, Loris Bennett wrote:
> Jon Ribbens writes:
>> On 2022-04-19, Loris Bennett wrote:
>>> I now realise that timedelta is not really what I need. I am interested
>>> solely in pure periods, i.e. numbers of seconds,
>>
>> That's exactly what timedelta is.
>>
>>> that I can convert
Jon Ribbens writes:
> On 2022-04-19, Loris Bennett wrote:
>> I now realise that timedelta is not really what I need. I am interested
>> solely in pure periods, i.e. numbers of seconds,
>
> That's exactly what timedelta is.
>
>> that I can convert back and forth from a format such as
>>
>>
On 2022-04-19, Loris Bennett wrote:
> I now realise that timedelta is not really what I need. I am interested
> solely in pure periods, i.e. numbers of seconds,
That's exactly what timedelta is.
> that I can convert back and forth from a format such as
>
> 11-22::44:55
I don't recognise
Jon Ribbens writes:
> On 2022-04-19, Loris Bennett wrote:
>> Jon Ribbens writes:
>>> On 2022-04-19, Loris Bennett wrote:
I now realise that timedelta is not really what I need. I am interested
solely in pure periods, i.e. numbers of seconds,
>>>
>>> That's exactly what timedelta
"Peter J. Holzer" writes:
> On 2022-04-16 20:35:22 -, Jon Ribbens via Python-list wrote:
>> On 2022-04-16, Peter J. Holzer wrote:
>> > On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote:
>> >> ... although now having looked into the new 'zoneinfo' module slightly,
>> >> it
On 2022-04-16 20:35:22 -, Jon Ribbens via Python-list wrote:
> On 2022-04-16, Peter J. Holzer wrote:
> > On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote:
> >> ... although now having looked into the new 'zoneinfo' module slightly,
> >> it really should have a giant red
On 2022-04-16, Dennis Lee Bieber wrote:
> On Sat, 16 Apr 2022 20:35:22 - (UTC), Jon Ribbens
> declaimed the following:
>>I can categorically guarantee you it is not. But let's put it a
>>different way, if you like, if I want to add 24 hours, i.e. 86,400
>>seconds (or indeed any other fixed
On Sun, 17 Apr 2022 at 08:37, Dennis Lee Bieber wrote:
> And proposals to make
> DST permanent year round -- so "noon" (1200hrs) is not "noon" (sun at
> zenith) pretty much anywhere.
>
Noon isn't precisely zenith anyway, for several reasons:
1) Time zones synchronize their clocks on the mean
On Sat, 16 Apr 2022 20:35:22 - (UTC), Jon Ribbens
declaimed the following:
>I can categorically guarantee you it is not. But let's put it a
>different way, if you like, if I want to add 24 hours, i.e. 86,400
>seconds (or indeed any other fixed time period), to a timezone-aware
>datetime in
On 2022-04-16, Peter J. Holzer wrote:
> On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote:
>> On 2022-04-16, Jon Ribbens wrote:
>> > On 2022-04-16, Peter J. Holzer wrote:
>> >> Python missed the switch to DST here, the timezone is wrong.
>> >
>> > Because you didn't let it use any
On Sun, 17 Apr 2022 at 05:38, Peter J. Holzer wrote:
>
> On 2022-04-17 02:46:38 +1000, Chris Angelico wrote:
> > On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote:
> > > For adding a datetime and timedelta I think the answer is clear.
> > > But subtracting two datetimes is ambiguous.
> > >
> >
On 2022-04-17 02:46:38 +1000, Chris Angelico wrote:
> On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote:
> > For adding a datetime and timedelta I think the answer is clear.
> > But subtracting two datetimes is ambiguous.
> >
>
> But if the difference between two datetimes is a timedelta, then
On 2022-04-16, Peter J. Holzer wrote:
> On 2022-04-16 13:47:32 -, Jon Ribbens via Python-list wrote:
>> That's impossible unless you redefine 'timedelta' from being, as it is
>> now, a fixed-length period of time, to instead being the difference
>> between two specific dates and times in
On Sun, 17 Apr 2022 at 03:52, Peter J. Holzer wrote:
>
> On 2022-04-17 02:46:38 +1000, Chris Angelico wrote:
> > On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote:
> > > On 2022-04-17 02:14:44 +1000, Chris Angelico wrote:
> > > > So which one is it? Which one do you get when you add days=7 to
On 2022-04-17 02:46:38 +1000, Chris Angelico wrote:
> On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote:
> > On 2022-04-17 02:14:44 +1000, Chris Angelico wrote:
> > > So which one is it? Which one do you get when you add days=7 to a
> > > datetime?
> >
> > For adding a datetime and timedelta I
On Sun, 17 Apr 2022 at 02:45, Peter J. Holzer wrote:
>
> On 2022-04-17 02:14:44 +1000, Chris Angelico wrote:
> > On Sun, 17 Apr 2022 at 02:03, Peter J. Holzer wrote:
> > > On the contrary. When a datetime is timezone aware, it must use that
> > > timezone's rules. Adding one day to a datetime
On 2022-04-17 02:14:44 +1000, Chris Angelico wrote:
> On Sun, 17 Apr 2022 at 02:03, Peter J. Holzer wrote:
> > On the contrary. When a datetime is timezone aware, it must use that
> > timezone's rules. Adding one day to a datetime just before a DST switch
> > must add 23 or 25 hours, not 24. This
On Sun, 17 Apr 2022 at 02:03, Peter J. Holzer wrote:
>
> On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote:
> > timedelta(days=1) is 24 hours (as you can check by
> > calling timedelta(days=1).total_seconds() ),
>
> It shouldn't be. 1 Day is not 24 hours in the real world.
>
> > but
On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote:
> On 2022-04-16, Jon Ribbens wrote:
> > On 2022-04-16, Peter J. Holzer wrote:
> >> Python missed the switch to DST here, the timezone is wrong.
> >
> > Because you didn't let it use any timezone information. You need to
> > either
On 2022-04-16 13:47:32 -, Jon Ribbens via Python-list wrote:
> On 2022-04-16, Peter J. Holzer wrote:
> > On 2022-04-14 15:22:29 -, Jon Ribbens via Python-list wrote:
> >> On 2022-04-14, Paul Bryan wrote:
> >> > I think because minutes and hours can easily be composed by multiplying
> >>
On 2022-04-16, Jon Ribbens wrote:
> On 2022-04-16, Peter J. Holzer wrote:
>> Python missed the switch to DST here, the timezone is wrong.
>
> Because you didn't let it use any timezone information. You need to
> either use the third-party 'pytz' module, or in Python 3.9 or above,
> the built-in
On 2022-04-16, Peter J. Holzer wrote:
> On 2022-04-14 15:22:29 -, Jon Ribbens via Python-list wrote:
>> On 2022-04-14, Paul Bryan wrote:
>> > I think because minutes and hours can easily be composed by multiplying
>> > seconds. days is separate because you cannot compose days from seconds;
On 2022-04-14 15:22:29 -, Jon Ribbens via Python-list wrote:
> On 2022-04-14, Paul Bryan wrote:
> > I think because minutes and hours can easily be composed by multiplying
> > seconds. days is separate because you cannot compose days from seconds;
> > leap seconds are applied to days at
On 2022-04-14, MRAB wrote:
> On 2022-04-14 16:22, Jon Ribbens via Python-list wrote:
>> On 2022-04-14, Paul Bryan wrote:
>>> I think because minutes and hours can easily be composed by multiplying
>>> seconds. days is separate because you cannot compose days from seconds;
>>> leap seconds are
On Fri, 15 Apr 2022 at 00:54, Loris Bennett wrote:
>
> Hi,
>
> With Python 3.9.2 I get
>
> $ import datetime
> $ s = "1-00:01:01"
> $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S")
> $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute,
> seconds=t.second)
> $ d.days
>
On Fri, 15 Apr 2022 at 03:45, Marco Sulla wrote:
>
> On Thu, 14 Apr 2022 at 19:16, MRAB wrote:
> >
> > When you're working only with dates, timedelta not having a 'days'
> > attribute would be annoying, especially when you consider that a day is
> > usually 24 hours, but sometimes 23 or 25 hours
On Thu, 14 Apr 2022 at 19:16, MRAB wrote:
>
> When you're working only with dates, timedelta not having a 'days'
> attribute would be annoying, especially when you consider that a day is
> usually 24 hours, but sometimes 23 or 25 hours (DST).
I agree. Furthermore, timedelta is, well, a time
On 2022-04-14 16:22, Jon Ribbens via Python-list wrote:
On 2022-04-14, Paul Bryan wrote:
I think because minutes and hours can easily be composed by multiplying
seconds. days is separate because you cannot compose days from seconds;
leap seconds are applied to days at various times, due to
On 2022-04-14, Paul Bryan wrote:
> I think because minutes and hours can easily be composed by multiplying
> seconds. days is separate because you cannot compose days from seconds;
> leap seconds are applied to days at various times, due to
> irregularities in the Earth's rotation.
That's an
Additionally, which datatype would you expect them to be returned in?
One could argument for int or float (Decimal?), both could be valid
datatypes, depending on how exact you might want them, while the second
is the time base of SI units.
Cheers
Lars
--
Lars Liedtke
Software Entwickler
I think because minutes and hours can easily be composed by multiplying
seconds. days is separate because you cannot compose days from seconds;
leap seconds are applied to days at various times, due to
irregularities in the Earth's rotation.
On Thu, 2022-04-14 at 15:38 +0200, Loris Bennett wrote:
"Loris Bennett" writes:
> Hi,
>
> With Python 3.9.2 I get
>
> $ import datetime
> $ s = "1-00:01:01"
> $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S")
> $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute,
> seconds=t.second)
> $ d.days
> 1
> $ d.seconds
> 61
Hi,
With Python 3.9.2 I get
$ import datetime
$ s = "1-00:01:01"
$ t = datetime.datetime.strptime(s, "%d-%H:%M:%S")
$ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute,
seconds=t.second)
$ d.days
1
$ d.seconds
61
$ d.minutes
AttributeError:
43 matches
Mail list logo