web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to update the Date Time field when its on the Different Time zone in c#

(0) ShareShare
ReportReport
Posted on by

Hello Guys,

I am facing a issue that the date time field in the form is being saved wrongly in the database and the server is configured at CST time zone.

So how can i manage it on the code level so that i will be able to save the actual date which i am passing from the UI. And i don't want to change in the CRM like behavior of the field.

Server is at CST Time Zone and i am passing Date from IST.

A great help will be much appreciated.

Thanks

Shashikant Saxena

  

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    You can use TimeZoneInfo class

    TimeZoneInfo targetZone = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");

    DateTime newDT = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, targetZone);

    Check links below hope it helps.

    stackoverflow.com/.../creating-a-datetime-in-a-specific-time-zone-in-c-sharp

    www.codeproject.com/.../How-can-i-get-CST-Central-Standard-Time-in-asp-net

    Thanks,

    Ridhima

  • Community Member Profile Picture
    on at

    Thanks for the response,

    I have already tried this approach but it does not work for me.

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    The datetime field are always stored in UTC time zone in database. These are than converted into users local/configured time zone. So if IST users enters a date, it will be saved as UTC in database. For a CST user, the UTC date time will then be converted from UTC to CST.  If you want to save the date time as is then you need to change the behaviour of the date to Timezone Independent.

    So even if you manipulate the date using code & timezone. It will still be saved based on the selecte behaviour of the field.

    You can read more about this here: www.magnetismsolutions.com/.../introduction-to-behaviours-of-date-and-time-fields-in-dynamics-365

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans