Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the date in the iOS Simulator?

Is there a way to change the date in the simulator to simulate for example Dec.02.2018, Feb.03.2018? I need to check if the code I have will react correctly given the date.

like image 338
Tom Avatar asked Jul 22 '17 20:07

Tom


2 Answers

Xcode 11 brought the ability to change the date (and time) using the simctl command line tool:

xcrun simctl status_bar booted override --time "2007-01-09T09:41:00-08:00"

The date and time is in the ISO 8601 format. Make sure to adjust the time zone if you want the clock to show the given time ("-08:00" is for PST/California, "+01:00" for Western Europe, ...).

like image 155
davidisdk Avatar answered Sep 30 '22 04:09

davidisdk


Change your mac system date and time. It would get reflected in simulator. Go to 'System Preferneces' -> Date and Time.

like image 28
Mohammad Sadiq Avatar answered Sep 30 '22 05:09

Mohammad Sadiq