Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTimeZoneMBS class.

NSTimeZoneMBS.abbreviationDictionary as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 13.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a dictionary holding the mappings of time zone abbreviations to time zone names.

Note that more than one time zone may have the same abbreviation—for example, US/Pacific and Canada/Pacific both use the abbreviation "PST." In these cases, abbreviationDictionary chooses a single name to map the abbreviation to.
(Read and Write computed property)

NSTimeZoneMBS.defaultTimeZone as NSTimeZoneMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 12.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the default time zone for the current application.
Example
MsgBox NSTimeZoneMBS.defaultTimeZone.name

The default time zone for the current application. If no default time zone has been set, this method invokes systemTimeZone and returns the system time zone.

Discussion
The default time zone is the one that the application is running with, which you can change (so you can make the application run as if it were in a different time zone).

If you get the default time zone and hold onto the returned object, it does not change if a subsequent invocation of setDefaultTimeZone changes the default time zone—you still have the specific time zone you originally got. Contrast this behavior with the object returned by localTimeZone.

NSTimeZoneMBS.knownTimeZoneNames as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 13.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an array of strings listing the IDs of all the time zones known to the system.
Example
MsgBox join(NSTimeZoneMBS.knownTimeZoneNames, EndOfLine)

NSTimeZoneMBS.localTimeZone as NSTimeZoneMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 12.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns an object that forwards all messages to the default time zone for the current application.
Example
MsgBox NSTimeZoneMBS.localTimeZone.name

An object that forwards all messages to the default time zone for the current application.

Discussion
The local time zone represents the current state of the default time zone at all times. If you get the default time zone (using defaultTimeZone) and hold onto the returned object, it does not change if a subsequent invocation of setDefaultTimeZone changes the default time zone—you still have the specific time zone you originally got. The local time zone adds a level of indirection, it acts as if it were the current default time zone whenever you invoke a method on it.

NSTimeZoneMBS.systemTimeZone as NSTimeZoneMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 12.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the time zone currently used by the system.
Example
MsgBox NSTimeZoneMBS.systemTimeZone.name

The time zone currently used by the system. If the current time zone cannot be determined, returns the GMT time zone.

Special Considerations
If you get the system time zone, it is cached by the application and does not change if the user subsequently changes the system time zone. The next time you invoke systemTimeZone, you get back the same time zone you originally got. You have to invoke resetSystemTimeZone to clear the cached object.

NSTimeZoneMBS.timeZoneForSecondsFromGMT(seconds as Integer) as NSTimeZoneMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 17.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates time zone object based on a delta from GMT.

Time zones created with this never have daylight savings and the offset is constant no matter the date; the name and abbreviation do NOT follow the POSIX convention (of minutes-west).

NSTimeZoneMBS.timeZoneWithName(name as string) as NSTimeZoneMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method Cocoa MBS MacBase Plugin 13.4 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the time zone object identified by a given ID.
Example
dim t as NSTimeZoneMBS = NSTimeZoneMBS.timeZoneWithName("Europe/Berlin")
MsgBox t.name

Name: The ID for the time zone.

Returns the time zone in the information directory with a name matching name.
Returns nil if there is no match for the name.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...