public method O2GTimeConverter.convert

Brief

Converts a datetime value to a specified time zone.

Declaration
C#
DateTime  convert (DateTime date, O2GTimeConverterTimeZone from, O2GTimeConverterTimeZone to)

Parameters
date

A datetime value to convert.

from

The time zone to convert from.

to

The time zone to convert to.

Details

Before calling the method, an instance of the O2GTimeConverter class must be obtained by using the O2GSession.getTimeConverter method. For example,

O2GTimeConverter converter = mSession.getTimeConverter();

convert function [hide]

O2GTimeConverter converter = mSession.getTimeConverter();
DateTime date = DateTime.UtcNow;
Console.WriteLine("Date in UTC timezone: " + date.ToString("yyyy-MM-dd HH:mm"))
date = converter.convert(date, O2GTimeConverterTimeZone.UTC, O2GTimeConverterTimeZone.Local);
Console.WriteLine("Date in local timezone: " + date.ToString("yyyy-MM-dd HH:mm"))

Declared in O2GTimeConverter

back