734 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
3
votes
2
answers
152
views
Handling Buffer Size Errors in strftime: ERANGE vs EOVERFLOW
I have an application where I need to generate date and time based on the locale using the strftime function provided by C's time.h:
#include <stdio.h>
#include <time.h>
#include <...
3
votes
3
answers
210
views
Python time.strftime gives different results for %Z and %z
I'm getting some strange behavior when I pass a UTC time struct to python's time.strftime. Using %z seems to always give me my local offset rather than 0:
>>> import time
>>> a = ...
0
votes
3
answers
72
views
strftime() alternating formats for the same placeholder
Is it possible in pandas to input alternating strftime() formats for the same placeholder in my word document?
So, let’s say the first row is "(%y %m %d)"; the second row is "(%d %m %y)&...
1
vote
1
answer
96
views
How do I set the time zone format to abbreviated on Windows 10?
I've written a python script that uses strftime() from the time module. On my windows 10 computer I get the long form format for time zone when I call strftime("%Z"), and I want to ...
5
votes
3
answers
190
views
What is the purpose of the %n and %t specifiers in the strftime function?
I was looking at the format specifiers and noticed that %n and %t were listed as valid specifiers. According to the documentation, the insert a new line and a horizontal tab character, respectively.
...
7
votes
2
answers
896
views
Format datetime in polars
I have a polars dataframe that contains a datetime column. I want to convert this column to strings in the format %Y%m. For example, all dates in January 2024 should be converted to "202401"....
0
votes
2
answers
170
views
How can I convert a Pandas dataframe column to datetime when the format for fractional seconds is inconsistent?
I have a Pandas dataframe which looks like:
import pandas as pd
df = pd.DataFrame({'datetime':[
'Jan 20, 2000 12:00:00',
'Jan 20, 2000 12:00:00.5',
'Jan 20, 2000 12:00:01'
]})
df
...
4
votes
2
answers
231
views
What is the historical significance of %s in the strftime function and why is it not documented? [closed]
I have been using tools like iperf3 when using its --timestamps feature that uses strftime under the hood for formatting time. Although I have seen examples that show the conversion specifier %s used ...
0
votes
0
answers
105
views
PHP error_reporting(E_ERROR); still shows E_DEPRECATED in PHP 8.1
PHP on command line shows E_DEPRECATED even when error_reporting() has been set to only report E_ERROR.
I have this dummy code:
$prev_level = error_reporting(E_ERROR);
echo $prev_level."\n";
...
1
vote
1
answer
69
views
Room SQLite: Using strftime to calculate how old a record since it is created
I am trying to create a query that delete all records that are 30 days old and above. Using ChatGPT this is what it came up
DELETE FROM posts WHERE strftime('%s', 'now') - strftime('%s', date) >= ...
1
vote
2
answers
165
views
Python Django: make strftime return german language, not english
In my Django project, I'm using strftime, specifically %b to get the abbreviated month name. Those names are returned in english. My settings contain the following:
LANGUAGE_CODE = 'de' # also tried '...
-1
votes
1
answer
97
views
Parse string date without padding zero into python date object
date = '10624'.
here,
1 is month i.e. Jan,
06 is day,
24 is Year.
I don't want to use any formatting on string (like add 0 at start in string or strip this string into small parts).
I want to convert ...
0
votes
1
answer
75
views
Discord bot displays hours as 00 in strftime statement
I am creating a Discord bot. When you enter the command, it is supposed to give a timestamp of the current time. I did this with strftime. But whenever the command is entered, the hours keep coming up ...
2
votes
2
answers
1k
views
How can I print current time as an ISO 8601 string with strftime?
I want to print the current time in ISO 8601 format as close as possible to Python's isoformat() function, which produces output like 2024年01月16日T09:32:46.090+01:00.
As a starting point, I have this ...
0
votes
1
answer
323
views
Unable to set custom timestamp xticks in seaborn lineplot [python]
My dataframe looks like this:
We see category values for a given Date/Time timestamp, showing year, month, day, and the time.
Plotted as a lineplot in seaborn, the x-axis looks like this:
Here we ...