Re: Problem saving datetime to file and reading it back for a calculation

2020-10-11 Thread Cameron Simpson
On 11Oct2020 20:39, Steve wrote: >Still, I enjoyed the kluge I created making it work based on discovery... Poking around in the datetime module will definitely make you aware of its power, and its pitfalls. Well worth doing. At the very least you'll usually want it when printing times out for

RE: Problem saving datetime to file and reading it back for a calculation

2020-10-11 Thread Steve
Thanks for the responses. Somehow, all of my python messages were shifted into the deleted folder so I missed all of them until I caught the one from MRAB. I will sift through them and probably update my technique to use seconds as suggested. Still, I enjoyed the kluge I created making it work

Re: Problem saving datetime to file and reading it back for a calculation

2020-10-11 Thread MRAB
On 2020-10-11 20:25, Steve wrote: Thanks for the response. I must have spent hours looking on-line for a method to treat datetime variables yet not one site mentioned the "pickle" module you indicatged. I did, however solve my problem. It may be a kluge but it seems to work. I learned that I

RE: Problem saving datetime to file and reading it back for a calculation

2020-10-11 Thread Steve
Thanks for the response. I must have spent hours looking on-line for a method to treat datetime variables yet not one site mentioned the "pickle" module you indicatged. I did, however solve my problem. It may be a kluge but it seems to work. I learned that I cannot use print() to display the

Re: Problem saving datetime to file and reading it back for a calculation

2020-10-10 Thread Chris Angelico
On Sun, Oct 11, 2020 at 12:57 PM Cameron Simpson wrote: > Personally I strongly dislike using datetimes for computation or as the > basis for time record keeping, essentially because of the timezone issue > but also because the human calendar is a complex disaster of illfitting > units (days in a

Re: Problem saving datetime to file and reading it back for a calculation

2020-10-10 Thread Cameron Simpson
On 10Oct2020 18:17, Steve wrote: >I would like to use the line: >HoursDiff = int((d2-d1).total_seconds()/3600) >to determine the difference in hours between two timedate entries. > >The variable d2 is from datetime.now() >and d1 is read from a text file. > >I can save d2 to the file only if I

Re: Problem saving datetime to file and reading it back for a calculation

2020-10-10 Thread Peter Pearson
On Sat, 10 Oct 2020 18:17:26 -0400, Steve wrote: > I would like to use the line: > HoursDiff = int((d2-d1).total_seconds()/3600) > to determine the difference in hours between two timedate entries. > > The variable d2 is from datetime.now() > and d1 is read from a text file. > > I can save d2 to

Problem saving datetime to file and reading it back for a calculation

2020-10-10 Thread Steve
I would like to use the line: HoursDiff = int((d2-d1).total_seconds()/3600) to determine the difference in hours between two timedate entries. The variable d2 is from datetime.now() and d1 is read from a text file. I can save d2 to the file only if I convert it to string and, at a later date, it