functions for date and cookies