I have a DateTime string "2014-10-09T07:01:39Z"
. I want to get the timezone from this string.
Asked
Active
Viewed 59 times
-2

CodeCaster
- 147,647
- 23
- 218
- 272

Ishtiaq
- 980
- 2
- 6
- 21
-
Does that string appear to contain a timezone? – CodeCaster Oct 28 '14 at 10:43
-
Your string doesn't have _any_ timezone information. So, that's not possible. – Soner Gönül Oct 28 '14 at 10:45
-
Then what is the 'Z' at the end of the string.? – Ishtiaq Oct 28 '14 at 10:46
-
@Ish How can we know that? This is your string. It might be an offset? – Soner Gönül Oct 28 '14 at 10:48
-
1Regarding [Z](http://stackoverflow.com/a/833143/1997232). – Sinatr Oct 28 '14 at 10:49
-
1Z means UTC. So your timezone is UTC. – Stephen Kennedy Oct 28 '14 at 10:53
1 Answers
-1
"2014-10-09T07:01:39Z" means 10/9/2014 7:01:39 AM +00:00
"2014-10-09T07:01:39" means 10/9/2014 7:01:39 AM +/-LocalTimeZone
var dof=DateTimeOffset.Parse("2014-10-09T07:01:39Z");
Console.WriteLine(dof.Offset);
//00:00:00
dof = DateTimeOffset.Parse("2014-10-09T07:01:39");
Console.WriteLine(dof.Offset);
//XX:00:00

Karata
- 1,079
- 8
- 16