Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<TimeCreated SystemTime="2020-03-31T19:59:37.754747Z" xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system" />



here this xml data is taken in one variable as var xeTimeCreated now i want to fetch data and time from it how can we fetch ?

What I have tried:

DateTime startDate = DateTime.Parse(xeTimeCreated.Attribute("SystemTime").Value);

but here date and time is taking as per system time means 4.30 hr ahead
Posted
Updated 30-Apr-20 20:59pm
Comments
gggustafson 9-Apr-20 13:41pm    
Insure that the time in xeTimeCreated is in UTC. Then use the DateTime methods to convert to the desired time zone (see https://docs.microsoft.com/en-us/dotnet/standard/datetime/converting-between-time-zones)

1 solution

x = xmlDoc.getElementsByTagName("title")[0];
y = x.childNodes[0];
 
Share this answer
 
Comments
CHill60 1-May-20 4:34am    
Where is the date and time that the OP requires?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900