---
title: "Convert time in string to UTC time?"  
description: "Convert time in string to UTC time?"  
author: "Anonymous User"  
published: 2014-01-31  
updated: 2014-01-31  
canonical: https://www.mindstick.com/forum/1938/convert-time-in-string-to-utc-time  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Convert time in string to UTC time?

I have a [string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) like this "2012.12.04T08:35:00" that represents a time in the "W. [Europe](https://yourviews.mindstick.com/view/85542/is-islam-a-threat-to-europe-find-out) [Standard](https://www.mindstick.com/articles/23223/naming-convention-or-coding-standard) Time" timezone.

[Now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now), I want to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) this properly to a c# [DateTime](https://www.mindstick.com/forum/12949/how-to-validate-if-a-datetime-field-is-not-null-empty) object in [UTC](https://www.mindstick.com/interview/33846/how-to-find-the-current-database-utc-date-and-time-in-sql-server) time.

What is the proper way to do this?

## Replies

### Reply by Pravesh Singh

Hi Ankita,\

Use TimeZoneInfo when converting between specific time zones:

```
TimeZoneInfo westInfo =    TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time");DateTime westTime = DateTime.Parse("2012.12.04T08:35:00");DateTime utcTime = TimeZoneInfo.ConvertTimeToUtc(westTime, westInfo);
```

## To address your confusion:

DateTime.Parse as used here makes no assumptions about the timezone of the given value. IT stores it with a DateTimeKind of Unspecified.

TimeZoneInfo.ConvertTimeToUtc as used here expects an Unspecified datetime, reads it as if it is in the explicitly specified time zone, and converts it to UTC.


---

Original Source: https://www.mindstick.com/forum/1938/convert-time-in-string-to-utc-time

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
