Functions to convert date to integer days since epoch