DateTime.Now returns UTC Time if we build Xamarin.Android app with azure pipeline.

Shingala A 25 Reputation points
2023-09-13T12:56:12.17+00:00

Hi, Team,

We have currently one project associated with Xamarin.Android. DateTime.Now returns UTC Time instead of returning local time only when we build Xamarin.Android app with azure pipeline. It is working fine if we create build using visual studio 2022. Our device time and time zone is also properly set. Issue is coming in android 14 devices only.

Looking forward to your response.

Thank you!

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Graham McKechnie 416 Reputation points
    2023-12-01T22:59:13.3166667+00:00

    Why not raise this issue at https://github.com/xamarin/xamarin-android/issues. At least then you can get a resolution regarding the pipeline problem. For what it is worth I have several Xamarin.Android apps published using VS 2022 that are upgraded to Android 14 and none have a problem with DateTime.Now returning incorrect values on Android 14 devices.

    Please note, that there is no advice to convert to Maui for Android-only apps. It is correct that support is going to be dropped for Xamarin. Android in May '24, but Android-only apps can be produced with Net8, they just need to be converted to Net8.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.