Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:23:13+00:00 2026-05-23T17:23:13+00:00

I am working on project to convert Standard time + DST ( 20110710115500 +1200

  • 0

I am working on project to convert Standard time + DST ( “20110710115500 +1200” ) to actual time.

It is on an XML file and I can pull and display the data, but I am looking to convert it so its readable.

Eg.. “20110710115500 +1200” to 11:55:00 10/07/2011

I am using visual studio and silver light, and its for a windows phone application.

I have been reading about TimeZoneInfo.ConvertTimeToUtc Method (DateTime, TimeZoneInfo), but I can’t seem to get that to work and I was hoping someone could point me in the right direction.

Thanks

My Code….. StartTime and EndTime and the dates I need to change.

EDIT: I have updated the code with your changes, but it is giving me an error when I attempt to run on emulator.

ERROR:

“When converting a string to DateTime, parse the string to take the date before putting each variable into the date time object”

Noted: Your right about the C# learning, I am currently working my way through a c# book. Thanks again for your help on this.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System.Xml;
using System.Xml.Linq;

namespace tvGuide
{
    public partial class TV2 : PhoneApplicationPage
    {
        public TV2()
        {
            InitializeComponent();
        }




        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            WebClient c = new WebClient();
            c.DownloadStringCompleted += new DownloadStringCompletedEventHandler(c_DownloadStringCompleted);
            c.DownloadStringAsync(new Uri("http://www.designized.com/tv/freeview.xml?"));
        }



        void c_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (e.Error != null)
                return;



            var r = XDocument.Parse(e.Result);


            listBox2.ItemsSource = from tv in r.Root.Descendants("programme")
                                   let channelE1 = tv.Attribute("channel")
                                   let nameEl = tv.Element("title")
                                   let urlEl = tv.Element("desc")
                                   let startE1 = tv.Attribute("start")
                                   let endE1 = tv.Attribute("stop")
                                   //let iconEl = tv.Element("icon")
                                   select new TV2guide
                                   {
                                       DisplayName = nameEl == null ? null : nameEl.Value,
                                       ChannelName = channelE1 == null ? null : channelE1.Value,
                                       ChannelURL = urlEl == null ? null : urlEl.Value,
                                       StartTime = startE1 == null ? (DateTime?)null : DateTime.Parse(startE1.Value),
                                       EndTime = endE1 == null ? (DateTime?)null : DateTime.Parse(endE1.Value),


                                       //ImageSource = iconEl == null ? null : iconEl.Attribute("src").Value,
                                   };
        }



        private void button3_Click_1(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }

        private void button4_Click_1(object sender, RoutedEventArgs e)
        {
            NavigationService.GoBack();
        }
    }

    public class TV2guide
    {
        public string DisplayName { get; set; }
        public string ChannelURL { get; set; }
        public string ImageSource { get; set; }
        public DateTime? StartTime { get; set; }
        public DateTime? EndTime { get; set; }
        public string ChannelName { get; set; }
    }





}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:23:14+00:00Added an answer on May 23, 2026 at 5:23 pm

    First you need to get the XML value into a DateTime variable

    DateTime showTime = DateTime.Parse(xmlValue);
    

    From there you will be able to manipulate it as needed to get it into the right timezone. There are ToLocalTime() and ToUniversalTime() methods.
    To get it back into a string to display you can use the .ToString() method and pass a format in.

    showTime.ToString("HH:mm:ss dd/MM/yyyy");
    

    Formatting information is on MSDN http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

    Edit:
    One more thing to consider, having written a Windows Phone EPG myself, is to check if the time your are being provided is actually correct for all timezones. For example we have national channels, and the news starts at 6pm local time, but the EPG source I was using had a single file for the national channel with times set to the east coast. So I had to just drop the timezone information from the XML and treat it as local time for those channels.

    Edit 2:
    You really need to learn the basics of C# before getting too far into this by the sounds of it. In your class definition TV2guide, change the proeprties StartTime and EndTime to be of type DateTime like this.

    public DateTime? StartTime { get; set; }
    public DateTime? EndTime { get; set; }
    

    In your LINQ-2-XML query change the lines that set StartTime and EndTime like this

    StartTime = startE1 == null ? (DateTime?)null : DateTime.ParseExact(startE1.Value, "yyyyMMddHHmmss zzz", DateTimeFormatInfo.CurrentInfo, DateTimeStyles.AssumeLocal),
    EndTime = endE1 == null ? (DateTime?)null : DateTime.ParseExact(endE1.Value, "yyyyMMddHHmmss zzz", DateTimeFormatInfo.CurrentInfo, DateTimeStyles.AssumeLocal),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project where I can to convert a api digit
I'm working on a project to convert an existing Java web application to use
I am currently working on a project to convert a number of Excel VBA
My team is working on a conversion project to convert one product (but with
I was recently working on a project where I needed to convert a regular
I'm working on a project about PDF rendering in the C# language. I convert
While working a project tonight, I ended up using one .js resource file for
I am working on a project where I have to import a DLL file
I am working on a project and I wrote two C programs that convert
I am recently working in a project. There I need to convert language from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.