Replace when with time