• Login
    Your ProfileLogout
  • join
  • about reply
Solidsoft Reply Logo
Menu
  • Newsroom
  • The Solid Blog
Choose language:
  • about Reply
  • join
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

27.11.2020

News & Communication

Solidsoft Reply successfully completes live deployment of National Blueprint System Release 7

Solidsoft Reply have recently completed the deployment of release 7 of the Solidsoft Reply National Blueprint System across 12 National Systems across Europe namely: Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Iceland, Ireland, Lithuania, Malta, Slovenia, Sweden & Switzerland.

20.11.2020

News & Communication

Solidsoft Reply Awarded Digital & Innovation Contract for NHS Trusts in the North of England

The NOE CPC has awarded Solidsoft Reply a 4 year Framework agreement for ICT Solutions Delivery (Professional Services & Consultancy Support) relevant to the needs of NHS and other health sector and public sector bodies.

AWARD

Solidsoft Reply Awarded Digital & Innovation Contract for NHS Trusts in the North of England

Solidsoft Reply Awarded Digital & Innovation Contract for NHS Trusts in the North of England 0

 
 
 
 
Reply ©​​ 2021​ - Company Information
  • About Reply​​​
  • Inves​tors​​
  • Newsroom
  • Follow Reply on
  • ​
​
  • ​About Solidsoft Reply
  • Privacy Policy
  • Information (Client)
  • Information (Supplier)
​