Tom
Tom

Reputation: 119

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.

Upvotes: 10

Views: 12178

Answers (2)

davidisdk
davidisdk

Reputation: 3794

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, ...).

Upvotes: 10

Mohammad Sadiq
Mohammad Sadiq

Reputation: 5241

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

Upvotes: 11

Related Questions