Looking for a way to calculate age from the following date/time format in python.
eg: 1956-07-01T00:00:00Z
I have written a code to do this by extracting the four characters of the string, convert it to an int and subtract it from 2017 but was looking to see if there is an efficient way to do it.
int age = (int) ((DateTime. Now - bday). TotalDays/365.242199);
You can get the current url by doing path_info = request. META. get('PATH_INFO') http_host = request.
Is this what you want ?
(pd.to_datetime('today').year-pd.to_datetime('1956-07-01').year)
Out[83]: 61
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With