New answers tagged datetime
5
votes
Check how many days a country has been independent
Delete all of your comments. None of them make the code more obvious than just reading it.
strftime is unused so don't import it.
Consider using a dictionary of ...
2
votes
Removing medications older than 180 days ago from a list
Bugs
The code has at least two bugs.
The first is when two adjacent list items are more than 6 months old, the second one will not be deleted. This occurs because when an item is deleted, the rest of ...
3
votes
Removing medications older than 180 days ago from a list
Use a list comprehension! When constructing lists in python by looping through others lists, its a lot more visually de-cluttered (not necessarily more performant) to just use python's list ...
-1
votes
Removing medications older than 180 days ago from a list
Depends on how much you care about performance. If you really care, don't use Python. If you kind of care, use Pandas in Python.
I cannot speak to how you load your data in Pandas because you haven't ...
1
vote
Accepted
Clear output line in terminal after use for countdown (different length strings)
ANSI escape sequences are not necessary, and the so-called archaic method of using a carriage return is preferred.
Avoid mixing sys.stdout with ...
2
votes
Accepted
Convert string to date C++
Unnecessary use of wide strings
In your example, there is no need to use wide strings for date_time_format and ss. Just use <...
0
votes
12 hour to 24 hour time conversion
In production code you would never manually parse a datetime like that. Instead you would use a round-trip through the datetime built-in:
...
1
vote
Accepted
12 hour to 24 hour time conversion
Program structure
timeconversion is not a very descriptive function name. What is it converting from, and what is it converting to? I suggest ...
4
votes
Accepted
Extract the last row in a dataframe with a timestamp before some given time
Don't use np.random; it's deprecated in favour of the new generator methods in the family of default_rng.
...
Top 50 recent answers are included
Related Tags
datetime × 1033python × 193
javascript × 192
java × 132
c# × 130
beginner × 115
performance × 96
formatting × 78
c++ × 74
php × 70
python-3.x × 57
sql × 44
jquery × 42
ruby × 42
c × 35
validation × 33
parsing × 32
interval × 32
algorithm × 30
converting × 29
strings × 27
html × 24
sql-server × 24
pandas × 24
object-oriented × 23