On 2020-11-04 23:02, Steve wrote:
Use the datetime module. Parse it with datetime.strptime and then format it with the .strftime method of the resultant datetime object.The text File entry is: BPd 2020-11-04 17:28:03.352027 66I bring it into the program using: with open("_TIME-DATE.txt" , 'r') as infile: for lineEQN in infile: # loop to find each line in the file for that dose and set it in a variable as follows: ItemDateTime = lineEQN[7:36].strip() When I print ItemDateTime, it looks like: 2020-11-04 17:28:03.352027 How do I display it as "Wednesday, November 4, 2020 5:28pm" ?
-- https://mail.python.org/mailman/listinfo/python-list
