Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
30 views

Converting string to datetime with milliseconds and timezone - Pyspark

I have the following 3 time records(Originally it is coming as String) to be converted to timestamp. CreateDate 2022-01-24 08:37:21.6670097 -06:00 2022-01-26 14:11:54.1950238 -06:00 2022-12-28 09:05:...
SivaC's user avatar
  • 3
-1 votes
1 answer
37 views

Incrementally number blocks of rows based on time limits in another column

I have a df with 3 fields as shown below, I'd like for shift number to incrementally generate based on pick start time. If pick start time between 22:00 and 0600, thats shift 1; then iterate for all ...
awo's user avatar
  • 13
0 votes
0 answers
33 views

Convert string MM/dd/yyyy hh/mm/ss tt to datetime MM/dd/yyyy hh/mm/ss tt

I want to convert a string that has the format MM/dd/yyyy hh/mm/ss tt to datetime with the same format I tried: DateTime date = DateTime.ParseExact("05/16/2019 10/30/15 AM", "MM/dd/yyyy ...
Serban Andrei's user avatar
0 votes
1 answer
58 views

How to parse a string and convert date values into datetime values in Java

I have a String that contains an expression like this: final String expression = "id = 123 AND openDate < 2023-01-01 AND closeDate = 2024-01-01"; As openDate and closeDate are deprecated ...
j3d's user avatar
  • 9,660
1 vote
1 answer
78 views

How to convert a datetime + timezone string to POSIXct/POSIXt with tzone attribute?

What would be a "canonical" way using {lubridate} package to convert a date-time + timezone from character to POSIXct/POSIXt while preserving the timezone into the tzone attribute? Example I'...
Emman's user avatar
  • 4,077
1 vote
2 answers
92 views

converting string to datetime without success in python

so I am reading the datetime from a file (but it is reading it as a string) and then converting it to a datetime format using this simple code last_update_str = flast.readlines()[-1].strip() ...
Priyank Shukla's user avatar
-3 votes
3 answers
279 views

String 'yyyy-mm-dd HH:mm:ss' was not recognized as a valid DateTime [duplicate]

I have a string like below: string expiredDate = "2026-05-24 18:54:55"; I want to convert it to DateTime format using the code below: DateTime myDate = DateTime.ParseExact(expiredDate, &...
cielo's user avatar
  • 3
2 votes
2 answers
85 views

Extracting date from string using regular expression

I have a use case to extract date part from a string like this: Job-2023-04-14.17.14.34 I need the output to be 2023-04-14. I tried the code below: # Extract the date part from the string using a ...
Nikita Amlani's user avatar
-1 votes
2 answers
276 views

How to Write Assertions for Comparing Datetime Strings with Timezone Offset

I'm working on a Python script that interacts with a server and retrieves datetime strings. The challenge I'm facing is comparing datetime strings from my script with those received from the server. ...
vladandreevza5557's user avatar
0 votes
0 answers
73 views

How can I format datetimes to strings containing asterisks/wildcards in Python?

I'd like to be able to do something like datetime(2022, 1, 1, 12, "*", "*", "*").strftime("%Y%m%d_%H%M%S") and have it output "20220101_***". How can ...
Clay's user avatar
  • 55
0 votes
2 answers
55 views

python convert datetime with time zone to date

I am trying to convert my datetime column to date. Here is how my date value looks: 2023-06-25T00:00:00.000Z and I want to convert it to 2023-06-25 This command; df['date'].dt.strftime('%Y-%m-%d') ...
Ty Kendall's user avatar
0 votes
2 answers
353 views

Python TypeError: 'datetime.datetime' object is not subscriptable. Unable to print desired number

Using this code I am trying to extract just the day number from this date. In this example it would be 30. When I try to print with the range[] function I get the error. How can I just print this ...
Colton Pelletier's user avatar
1 vote
2 answers
41 views

Conversion of date to string resulting in "None" in the string but no error in python

I am trying to create a email body that I will then be able to send, the code works and returns the values that I expect until: email_text = "Please can you " + str(move_plates) + " and ...
Sabrina's user avatar
  • 21
0 votes
0 answers
120 views

How can I convert Excel date columns to ISO Dates using string manipulation?

I have been practising Excel as I have been applying to apprenticeships. During this task I've been trying to figure out how to use string manipulation to convert each date column (I2 and K2) to ISO ...
Bobby's user avatar
  • 1
0 votes
1 answer
56 views

Keep getting FormatException on DateTime.ParseExact

I am trying to convert a date stored as string to DateTime using DateTime.ParseExact like below var myDate = DateTime.ParseExact("3/14/2023 4:08:30 PM", "M/dd/yyyy h:mm:ss tt", ...
Luis Eduardo's user avatar

15 30 50 per page
1
2 3 4 5
77