<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Convert UTC DateTime to Local Date Time in Product Forum</title>
    <link>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47435#M3177</link>
    <description>Hello,

using the Now() Function in a calculation stage I get the representation of Date an Time in UTC.
But what is, when I already have an UTC-Datetime and after all calculation is done I like to convert this to Local Date Time for user output.

How can I accomplish this?

I know, that there are two other functions in a calculation stage UTCTime() and LocalTime() but they are only returning a Time-Value without the date part. And what I need is both - Date and Time.

I also tried doing this in a code stage.

For example:

------

DateTime dtutc;
DateTime dtlocal;
TimeZoneInfo infoLocal = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");

dtutc = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Utc);
dtlocal = TimeZoneInfo.ConvertTimeFromUtc(dtutc, infoLocal);

Console.WriteLine(dtutc.ToString());
Console.WriteLine(dtlocal.ToString());

----

This code works perfectly at home on my private PC, because the difference between UTC and Local-Time
is exactly the 2 hour difference from UTC to the time in my country.

But the same code - exception Console WriteLine - in Blue Prism I get exactly the same value for UTC an Local Time.

Why is this? What am I missing?

Thanks

&amp;nbsp;

&amp;nbsp;</description>
    <pubDate>Thu, 25 Oct 2018 11:51:00 GMT</pubDate>
    <dc:creator>ChristianPanhan</dc:creator>
    <dc:date>2018-10-25T11:51:00Z</dc:date>
    <item>
      <title>Convert UTC DateTime to Local Date Time</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47435#M3177</link>
      <description>Hello,

using the Now() Function in a calculation stage I get the representation of Date an Time in UTC.
But what is, when I already have an UTC-Datetime and after all calculation is done I like to convert this to Local Date Time for user output.

How can I accomplish this?

I know, that there are two other functions in a calculation stage UTCTime() and LocalTime() but they are only returning a Time-Value without the date part. And what I need is both - Date and Time.

I also tried doing this in a code stage.

For example:

------

DateTime dtutc;
DateTime dtlocal;
TimeZoneInfo infoLocal = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");

dtutc = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Utc);
dtlocal = TimeZoneInfo.ConvertTimeFromUtc(dtutc, infoLocal);

Console.WriteLine(dtutc.ToString());
Console.WriteLine(dtlocal.ToString());

----

This code works perfectly at home on my private PC, because the difference between UTC and Local-Time
is exactly the 2 hour difference from UTC to the time in my country.

But the same code - exception Console WriteLine - in Blue Prism I get exactly the same value for UTC an Local Time.

Why is this? What am I missing?

Thanks

&amp;nbsp;

&amp;nbsp;</description>
      <pubDate>Thu, 25 Oct 2018 11:51:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47435#M3177</guid>
      <dc:creator>ChristianPanhan</dc:creator>
      <dc:date>2018-10-25T11:51:00Z</dc:date>
    </item>
    <item>
      <title>Try the attached Chris…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47436#M3178</link>
      <description>Try the attached Chris. Admittedly, it should be a lot easier&amp;nbsp;https://portal.blueprism.com/products/enhancement-request</description>
      <pubDate>Thu, 25 Oct 2018 13:43:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47436#M3178</guid>
      <dc:creator>John__Carter</dc:creator>
      <dc:date>2018-10-25T13:43:00Z</dc:date>
    </item>
    <item>
      <title>BluePrism converts all non…</title>
      <link>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47437#M3179</link>
      <description>BluePrism converts all non-UTC DateTime back to UTC on Code Stage output as described in documentation (page 3):
&lt;A href="https://portal.blueprism.com/system/files/2017-11/v6%20Data%20Sheet%20-…" target="test_blank"&gt;https://portal.blueprism.com/system/files/2017-11/v6%20Data%20Sheet%20-…&lt;/A&gt;
Workaround to this is setting local time to DateTime instance and specifying it's kind property to UTC:
----------------------
DateTime dtutc;
DateTime dtlocal;
TimeZoneInfo infoLocal = TimeZoneInfo.FindSystemTimeZoneById(""Central European Standard Time"");
dtutc = DateTime.SpecifyKind(DateTime.UtcNow, DateTimeKind.Utc);
dtlocal = TimeZoneInfo.ConvertTimeFromUtc(dtutc, infoLocal);
dtOutput = DateTime.Specifykind(dtlocal, DateTimeKind.Utc).ToString();
------------------------
Above will assing your local time converted from UTC and assign it to output without converting back to UTC.</description>
      <pubDate>Wed, 31 Oct 2018 17:09:00 GMT</pubDate>
      <guid>https://community.blueprism.com/t5/Product-Forum/Convert-UTC-DateTime-to-Local-Date-Time/m-p/47437#M3179</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-10-31T17:09:00Z</dc:date>
    </item>
  </channel>
</rss>

