By default each collection will be created with time zone UTC. This function can be used to change the time zone for a collection. If changed, the functions datetime(..) and timeval(..) will use the collections time zone unless specified otherwise. See time_zones_info() for a list of all available timezones.

Use collection_info(..) to view the current time zone for a collection.

This function generates an event.


set_time_zone(collection, zone)


Argument Type Description
collection str/int (required) Collection name or Id to change the time zone for.
zone str (required) New time zone.

Return value

Returns nil if successful.


This code changes the password for user admin:

// Change the time zone to Europe/Amsterdam
set_time_zone('stuff', 'Europe/Amsterdam');

Return value in JSON format