• about reply
Solidsoft Reply Logo
Menu
  • What we do
  • Pharmaceutical Sector
  • The Solid Blog
  • Newsroom
  • Contact Us
  • about Reply
Solidsoft Reply Logo

Search

Focus On

Blog

DateTime Conversion with Daylight Saving Time (DST)

Author: Ratnakar Sinha

A very common scenario faced by most of us these days is the conversion of datetime value from UTC to local time zone or from local to UTC or from one local time zone to another local time zone. The matter gets complicated when conversion has to take care of Daylight Saving Time (DST). DST change is applied in different regions at a different date each year. There is no standard pattern of when it will be applied each year. Hence it cannot be determined in advance. Most applications end up with a scheduled manual configuration change task to adjust for clock change.

There are methods available in .Net and other programming languages to automate this process. TimeZoneInfo class represents any time zone in the world. The time zone identifier (Id) property of TimeZoneInfo class is a key string that uniquely identifies a particular time zone. A complete list of all the timezones referenced by the Id property of TimeZoneInfo class can be obtained using below code-

DateTime Conversion with Daylight Saving Time 1 

Above code will display a list of time zone Id available in Windows registry. Samples like-

  • Dateline Standard Time
  • UTC-11
  • Samoa Standard Time
  • Hawaiian Standard Time
  • Alaskan Standard Time
  • Pacific Standard Time (Mexico)
  • Pacific Standard Time
  • US Mountain Standard Time
  • Mountain Standard Time (Mexico)
  • Mountain Standard Time
  • GMT Standard Time
  • …
  • …

Datetime value can then be converted from UTC to any of above local time zone by using below code-

DateTime Conversion with Daylight Saving Time 2 

Similarly, Datetime value can be converted to UTC from any of above local time zone by using below code-

DateTime Conversion with Daylight Saving Time 3 

Datetime conversion using above method takes care of daylight savings and hence simplifies overall implementation by removing any manual task.

RELATED CONTENTS

Solidsoft Reply becomes a GS1 UK Partner

Solidsoft Reply becomes a GS1 UK Partner 0

Read more

Pharmaceutical Sector

Solidsoft Reply develop cloud-based solutions, integrate unconnected systems and automate business functions to provide the step change needed for Pharmaceutical businesses to thrive.

FIND OUT MORE

Pharmaceutical Sector 0

HEALTHCARE & PHARMACEUTICAL INTEGRATION SPECIALISTS

Empowering health & pharmaceutical organisations across
Europe to become more efficient and enable new levels of care.


NOT HEARD OF US?

HEALTHCARE & PHARMACEUTICAL INTEGRATION SPECIALISTS 0
 
 
 
 
Reply ©​​ 2023​ - Company Information -
 PrivacyCookie Settings​
  • About Reply​​​
  • Inves​tors​​
  • Newsroom
  • Follow Reply on
  • ​
  • ​
​
  • ​About Solidsoft Reply
  • Privacy & Cookies Policy
  • Information (Client)
  • Information (Supplier)​