Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

custom workflow - own date functions arent working correct (timezone problem (german tz +2))

$
0
0

Hi,

we created some custom workflows to handle date f.e. date offset, create date, date extract etc.

the result is not as expected. It is +2 hours.

What we did:

protected override void Execute(CodeActivityContext context)
        {
            int year = Year.Get<int>(context);

            int month = Month.Get<int>(context);

            int day = Day.Get<int>(context);

            int hour = Hour.Get<int>(context);

            int minute = Minute.Get<int>(context);

            int second = Second.Get<int>(context);

            Result.Set(context, new DateTime(year, month, day, hour, minute, second).ToUniversalTime());
        }

protected override void Execute(CodeActivityContext context)
        {
            int year = Year.Get<int>(context);

            int month = Month.Get<int>(context);

            int day = Day.Get<int>(context);

            int hour = Hour.Get<int>(context);

            int minute = Minute.Get<int>(context);

            int second = Second.Get<int>(context);

            Result.Set(context, new DateTime(year, month, day, hour, minute, second).ToUniversalTime());
        }

Date: 1. June 2018 00:00:00
if we do a new DateTime(18, 6, 1, 0, 0, 0).ToUniversalTime());

we expect to get: 31.5.18 22:00:00 cause we did ToUniversalTime() because we thougt to get the correct results if we only use utc times in all custom workflows steps with date functions.

then we store it in the date attribute (the 31.5.18 22:00) and expect that it is showed as 1.6.18 00:00.

But it is showed as 1.6.18 02:00

Why?

and if we use the TimeZoneInfo.ConvertTimeToUtc(.... or if we use the convert to CET .. it returns the same result. We expected to get a difference from 2 hours if one is converted to utc and the other is converted to cet.

Please can you help?

many thx, Peter


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images