simplified function dateAsKey(timestamp)