Function to get post date