Python Forum
Problem with datetime module
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with datetime module
#4
import datetime
   ...
    date_diff = datetime.datetime.now() - test_date
   ...
 
I was writing similar answer but was ninjad by buran :-). Very good answer and I like it.

Observation / nitpicking: it is matter of preference but one option is to use datetime.datetime.today() which is for me personally more in line with 'explicit is better than implicit'. I am not speaking english natively so for me 'today' is associated with date and 'now' with time. However, it is a matter of expected behaviour of code rather than personal biases.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
Problem with datetime module - by PierreSoulier - Jul-24-2018, 07:56 AM
RE: Problem with datetime module - by buran - Jul-24-2018, 08:19 AM
RE: Problem with datetime module - by perfringo - Jul-24-2018, 11:03 AM
RE: Problem with datetime module - by PierreSoulier - Jul-24-2018, 08:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem with memory_graph module akbarza 3 421 Mar-04-2024, 10:15 AM
Last Post: snippsat
  datetime module question jacksfrustration 9 1,882 Jan-12-2024, 04:54 AM
Last Post: deanhystad
  problem using coloeama module akbarza 3 613 Jan-08-2024, 07:31 AM
Last Post: akbarza
  problem in using subprocess module akbarza 5 1,079 Sep-24-2023, 02:02 PM
Last Post: snippsat
  problem in import module from other folder akbarza 5 1,524 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  problem in using pyqrcode module to create QRcode akbarza 9 2,089 Aug-23-2023, 04:17 PM
Last Post: snippsat
  Problem with Pyinstaller. No module named '_tkinter' tonynapoli2309 0 1,041 May-15-2023, 02:38 PM
Last Post: tonynapoli2309
  Problem with module time and leap seconds Pedroski55 3 1,276 Oct-07-2022, 11:27 PM
Last Post: Pedroski55
  Problem with datetime [SOLVED] AlphaInc 3 2,881 Apr-22-2022, 01:33 PM
Last Post: snippsat
  2-dataframe, datetime lookup problem Mark17 0 1,257 Jan-27-2022, 01:02 AM
Last Post: Mark17

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020