Changing the time and date in Xcode simulator
Change your system time on the host Mac. The Simulator runs a separate userspace but shares the kernel so it doesn't have a notion of a different time from the host.
Old question, modern answer:
With Xcode 11, Apple shipped new features for the simctl tool, which allows you to have a bit more control over what the simulators look like by overriding status bar values.
Finding the correct device
The command xcrun simctl list
lists the currently installed simulators and gives their status:
% xcrun simctl list== Device Types ==<list of device types>== Runtimes ==<list of runtimes>== Devices ==-- iOS 13.5 -- iPhone 11 (A2A694CF-8DA3-4371-AD2D-A2592A5C770C) (Shutdown) iPhone 11 Pro (F36583E8-6833-4526-8622-CE24022BE876) (Booted) iPhone 11 Pro Max (82029941-193B-423E-BE89-DD3E1C0B12E6) (Shutdown)
The output of this command is very long so NSHipster was nice enough to provide a command that prints the UDID
of the currently booted device in their simctl article:
$ xcrun simctl list devices | \ grep "(Booted)" | \ grep -E -o -i "([0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12})"9FED67A2-3D0A-4C9C-88AC-28A9CCA44C60
Grab the appropriate device UDID and pass that into the following command to change the simulator's current time:
% xcrun simctl status_bar F36583E8-6833-4526-8622-CE24022BE876 override --time "9:41"%
Running xcrun simctl help status_bar
will show a full range of options:
$ xcrun simctl help status_barSet or clear status bar overridesUsage: simctl status_bar <device> [list | clear | override <override arguments>]Supported Operations: list List existing overrides. clear Clear all existing status bar overrides. override <override arguments> Set status bar override values, according to these flags. You may specify any combination of these flags (at least one is required): --time <string> Set the date or time to a fixed value. If the string is a valid ISO date string it will also set the date on relevant devices. --dataNetwork <dataNetworkType> If specified must be one of 'wifi', '3g', '4g', 'lte', 'lte-a', or 'lte+'. --wifiMode <mode> If specified must be one of 'searching', 'failed', or 'active'. --wifiBars <int> If specified must be 0-3. --cellularMode <mode> If specified must be one of 'notSupported', 'searching', 'failed', or 'active'. --cellularBars <int> If specified must be 0-4. --operatorName <string> Set the cellular operator/carrier name. Use '' for the empty string. --batteryState <state> If specified must be one of 'charging', 'charged', or 'discharging'. --batteryLevel <int> If specified must be 0-100.