Perform timezone operations

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Date operations and timers >

Perform timezone operations

Overview

Many business situations require date-time comparisons and calculations. This section provide some examples on how to perform timezones operations.

Convert user time to server time zone.

Convert server time to a specified time zone.

Convert server time to users time zone.

Convert a specified time zone to server time.

Get offset for specified location.

Get offset for organization.

Get offset for user.

Get offset for working time zone.

 

To illustrate how to perform date operations let's take the following example: A Office Supply Request Process manages the necessary activities to request and approve office supplies. When an employee creates a request, he/she must enter the Request date and the Quotation date of each quotation.

 

In this example, we will use date operations in order to:

Assigns today's date to the request date (RequestDate attribute).

Set the duration of Activities.

Verify that the Products receive date is greater than the Request date. If not, display a validation message.

 

The data model of the Process is as follows:

 

TimezoneOperations01

 

Convert user time to server timezone

Converts a date-time value that is relative to a user's time zone into the servers time zone.

To convert the Request Date attribute to the server time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations04

 

ConvertUserTimetoServerTime(int idUser, DateTime userTime);

Click OK to save the changes.

 

Convert server time to a specified time zone

Converts a date in server time (UTC+0) to the equivalent date in the specified time zone.

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations05

 

ConvertServerTimeToTimeZoneTime(string sTimeZoneName, DateTime serverTime);

Click OK to save the changes.

 

Convert a specified time zone to server time

Converts a date-time value from a specified time zone to server time (UTC+0).

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations06

 

ConvertServerTimetoUserTime(int idUser, DateTime serverTime)

Click OK to save the changes.

 

Convert a specified time zone to server time

Converts a date-time value from a specified time zone to server time (UTC+0).

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations11

 

ConvertTimeZoneTimeToServerTime(string sTimeZoneName, DateTime timeZoneTime);

Click OK to save the changes.

 

Get offset for specified location

Returns the difference in minutes between a location’s time zone and the server time (UTC+0).

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations07

 

GetOffsetForLocation(int idLocation);

Click OK to save the changes.

 

Get offset for organization

Returns the difference in minutes between an organization’s time zone and the server time (UTC+0).

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations08

 

GetOffsetForOrganization(int idOrg);

Click OK to save the changes.

 

Get offset for user

Returns the difference in minutes between a specific user's defined time zone and the server time (UTC+0).

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations09

 

GetOffsetForUser(int idUser);

Click OK to save the changes.

 

Get offset for working time zone

Returns the difference in minutes between the time zone defined in the WorkingTimeZone key and the server time (UTC+0).

To convert the Request Date attribute to the specified time zone, go to the fourth step of the Bizagi Process Wizard and select Activity Actions.

Click the Task in which this action will be performed and create an Expression.

 

TimezoneOperations02

 

Add an expression module and select the attribute to which today's date will be assigned.

Use the Data Model option to navigate the Data Model.

 

TimezoneOperations03

 

The expression would be as follows:

 

TimezoneOperations10

 

GetOffsetForWorkingTimeZone();

Click OK to save the changes.


Last Updated 5/21/2025 5:24:56 PM