strftime Questions

3

Solved

I have the following Time object: [8] pry(#<#<Class:0x007f928f12f560>>)> display_num => 2015-02-19 09:00:00 -0600 [9] pry(#<#<Class:0x007f928f12f560>>)> display_nu...
Antimonyl asked 2/2, 2015 at 22:12

3

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...
Piliform asked 8/8 at 8:2

2

Solved

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&qu...
Codeclination asked 6/8 at 21:9

5

Solved

I have a datetime that is a string I read from a text file. I want to trim the extra milliseconds off of it, but I want to convert it to a datetime variable first. This is because it may be in diff...
Steiger asked 23/3, 2015 at 17:11

5

Solved

Every time I use: time.strftime("%z") I get: Eastern Daylight Time However, I would like the UTC offset in the form +HHMM or -HHMM. I have even tried: time.strftime("%Z") Which still yield...
Inaugurate asked 7/8, 2014 at 16:20

20

I have a string representing a unix timestamp (i.e. "1284101485") in Python, and I'd like to convert it to a readable date. When I use time.strftime, I get a TypeError: >>>import...
Manganous asked 10/9, 2010 at 6:56

9

Solved

My dataframe has a DOB column (example format 1/1/2016) which by default gets converted to Pandas dtype 'object'. Converting this to date format with df['DOB'] = pd.to_datetime(df['DOB']), the date...
Fetor asked 28/6, 2016 at 5:26

22

When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th, ie. so 01 is 1? Can't find a %thingy for that? Thanks!
Fears asked 25/5, 2009 at 0:11

18

Solved

I tried using $(date) in my bash shell script, however, I want the date in YYYY-MM-DD format. How do I get this?
Crenshaw asked 9/9, 2009 at 19:6

3

Solved

I have a simple SQL for calculating week number in my reports on SQLite SELECT STRFTIME('%W', 'date_column') It was correct for 2009-2012. In 2013 I got always the wrong week number. For exampl...
Huoh asked 26/2, 2013 at 6:14

2

Solved

I'm trying to convert string timestamps to polars datetime from the timestamps my camera puts in it RAW file metadata, but polars throws this error when I have timestamps from both summer time and ...
Orling asked 4/1, 2023 at 10:7

10

Solved

I have a date string with the format 'Mon Feb 15 2010'. I want to change the format to '15/02/2010'. How can I do this?
Hunkers asked 15/2, 2010 at 10:49

6

Solved

i'm trying to format the date like this, 2015-12-02T12:57:17+00:00 here's my code time.strftime("%Y-%m-%dT%H:%M:%S%z", time.gmtime()) which gives this result, 2015-12-02T12:57:17+0000 i can'...
Blanca asked 2/12, 2015 at 14:9

2

Solved

C++ defines time formatting functions in terms of strftime, which requires a struct tm "broken-down time" record. However, the C and C++03 languages provide no thread-safe way to obtain such a reco...
Danzig asked 6/9, 2011 at 0:37

3

I'm trying to create AWK script that will filter the input file according to some pattern, and use the strftime() function for some calculations. ($2 ~ /^[HB]/ && $2 ~ /n$/){ print strfti...
Prosecutor asked 10/9, 2010 at 11:24

3

Solved

An API returns a timestamp as UNIX timestamp at UTC and I would like to know if this timestamp was more than x seconds ago. As expected, this works fine with os.time() - x > timestamp in UTC, bu...
Defence asked 8/5, 2017 at 20:59

2

Solved

Parsing a date string using datetime.strptime such as: from datetime import datetime datetime.strptime('AUG21 3:26PM', '%b%d %I:%M%p') Results in 1900-08-21 15:26:00 How can I write something si...
Lorenzo asked 21/8, 2013 at 23:47

5

Solved

I am getting the error undefined method `strftime' for "2013-03-06":String when trying to display a date normally (June Sunday 3, 2013 or something similar) from the string 2013-03-06 using strf...
Patrizius asked 31/3, 2013 at 23:5

7

Solved

I am getting the lovely � box where spanish characters should be displayed. (ie: ñ, á, etc). I have already made sure that my meta http-equiv is set to utf-8: <meta http-equiv="Content-Type" co...
Kent asked 1/2, 2013 at 15:26

8

Solved

I'm working on a site and my customer is from Russia. He said that the month translation in the news is wrong. For example, September: I get this from php: Сентябрь and this from him: Сентября ...
Salimeter asked 27/9, 2011 at 9:46

3

I have $date = $run['at']; which gives me 2013-06-03T16:52:24Z (from a JSON input). To transform it to get for example "d M Y, H:i" I use $date = new DateTime($run['at']); echo $date->format('d...
Karns asked 3/6, 2013 at 22:33

8

Solved

I want to format a date object so that I can display strings such as "3rd July" or "1st October". I can't find an option in Date.strftime to generate the "rd" and "st". Any one know how to do this?...
Shaven asked 4/7, 2009 at 10:12

2

I have a dataframe of information. I set the index to be the received date and time. Now I want a list I set the df index doing this: df.index = pd.to_datetime(df.index, format='%m/%d/%Y %H:%M'...
Chariot asked 29/7, 2015 at 20:27

1

Solved

I'm trying to auto mark the output file with timestamps with ffmpeg. Here's my test cmd: .\ffmpeg.exe -y -loglevel 99 -i test.mp3 -strftime 1 %Y.ogg I expected a file named 2020.ogg, however onl...
Thermoluminescent asked 18/5, 2020 at 11:53

11

This is the code I use to get the date (in spanish): $fecha = strftime("%d de %B, %Y, a las %l:%M %p"); and I get: 27 de julio, 2011, a las 7:10 So the question is, where is my PM (or AM)? M...
Trotta asked 28/7, 2011 at 0:41

© 2022 - 2024 — McMap. All rights reserved.