2/11/2020 11:49:00 AM 2/11/2020 9:55:00 PM
How to convert this into Secs.. Conersion of AM and PM is not working as expected
2/11/2020 9:55:00 PM
| eval "Bridge End Date In Sec"=tonumber(strftime(strptime('Bridge End Date',"%m/%d/%Y %H:%M:%S %p"),"%s"))
1581440100
2/11/2020 11:49:00 AM
| eval "Bridge Start Date In Sec"=tonumber(strftime(strptime('Bridge Start Date',"%m/%d/%Y %H:%M:%S %p"),"%s"))
1581446940
%p is not wrking?
1581440100 1581446940 Values retued as this which is not correct. End is lesser thatn the start date
Hi,
You need to use %I
instead of %H
, %H
is for 24 hour format and in this case it will take 09 PM
as 09 AM
So try
| eval "Bridge End Date In Sec"=tonumber(strftime(strptime('Bridge End Date',"%m/%d/%Y %I:%M:%S %p"),"%s"))
I get different numbers for the same date-time strings. Perhaps it's because you're over-working them (strptime
returns a number so there's no need to convert back to a string and into a number again). Try
| eval "Bridge End Date In Sec"=strptime('Bridge End Date',"%m/%d/%Y %H:%M:%S %p")
Hi,
You need to use %I
instead of %H
, %H
is for 24 hour format and in this case it will take 09 PM
as 09 AM
So try
| eval "Bridge End Date In Sec"=tonumber(strftime(strptime('Bridge End Date',"%m/%d/%Y %I:%M:%S %p"),"%s"))