Time Date Conversion?

Larry Martell larry.martell at gmail.com
Wed Nov 4 18:47:18 EST 2020


On Wed, Nov 4, 2020 at 6:21 PM Steve <Gronicus at sga.ninja> wrote:
>
> The text File entry is:
>    BPd 2020-11-04 17:28:03.352027  66
>
> I 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" ?

Look at strptime/strftime


More information about the Python-list mailing list