I have been researching everywhere for a solution to this problem. Any help would be much appreciated.
I would like to take the time from the GPS data and need to convert that to a human readable format, may be like YYYY-MM-DD HH:MM:SS.
Following is the GPS dataformat:
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
Here, 123519 is fix taken at 12:35:19 UTC and 230394 is the date - 23rd of March 1994
Thanks.
You can use something like
for line in data.split('\n') :
if line.startswith( '$GPRMC' ) :
lat, _, lon = line.strip().split(',')[2:5]
to manually bring the string to a suitable format. Then pass this to datetime.strptime
:
from datetime import datetime
datetime_object = datetime.strptime('Jun 1 2005 1:33PM', '%b %d %Y %I:%M%p')
Or use a library like