Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Date Format In XML in converting excel file in a folder

Date Format In XML in converting excel file in a folder

Scheduled Pinned Locked Moved ASP.NET
csharpxmlquestionannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rummer
    wrote on last edited by
    #1

    How we get XML tag value in MM/DD/YYYY format in .net with c# ?? private string getXmlTagDate(XmlElement xEle, string name) { XmlNodeList xList; string text; xList = xEle.GetElementsByTagName(name); if (xList.Count > 0) { text = xList[0].InnerText.ToString(); text = Convert.ToDateTime(text).ToShortDateString(); } else { text = "00/00/0000"; } return text; } this function work properly for text value and we get this in date format <?xml version="1.0" standalone="yes"?> <NewDataSet> <PinType_TABLE> <pinname>HALF UNIT</pinname> <fullvalue>12000</fullvalue> <percent_value>50</percent_value> <pin_type>P</pin_type> <pin_price>6000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-02-01T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>Full</pinname> <fullvalue>12000</fullvalue> <percent_value>100</percent_value> <pin_type>P</pin_type> <pin_price>12000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-02-03T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>fourth unit</pinname> <fullvalue>12000</fullvalue> <percent_value>25</percent_value> <pin_type>P</pin_type> <pin_price>3000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-05-21T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>s.s</pinname> <fullvalue>12000</fullvalue> <percent_value>0</percent_value> <pin_type>P</pin_type> <pin_price>0</pin_price> <ind_active>1</ind_active> <CreateOn>2009-07-16T00:00:00+05:30</CreateOn> </PinType_TABLE> </NewDataSet>

    P K 2 Replies Last reply
    0
    • R rummer

      How we get XML tag value in MM/DD/YYYY format in .net with c# ?? private string getXmlTagDate(XmlElement xEle, string name) { XmlNodeList xList; string text; xList = xEle.GetElementsByTagName(name); if (xList.Count > 0) { text = xList[0].InnerText.ToString(); text = Convert.ToDateTime(text).ToShortDateString(); } else { text = "00/00/0000"; } return text; } this function work properly for text value and we get this in date format <?xml version="1.0" standalone="yes"?> <NewDataSet> <PinType_TABLE> <pinname>HALF UNIT</pinname> <fullvalue>12000</fullvalue> <percent_value>50</percent_value> <pin_type>P</pin_type> <pin_price>6000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-02-01T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>Full</pinname> <fullvalue>12000</fullvalue> <percent_value>100</percent_value> <pin_type>P</pin_type> <pin_price>12000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-02-03T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>fourth unit</pinname> <fullvalue>12000</fullvalue> <percent_value>25</percent_value> <pin_type>P</pin_type> <pin_price>3000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-05-21T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>s.s</pinname> <fullvalue>12000</fullvalue> <percent_value>0</percent_value> <pin_type>P</pin_type> <pin_price>0</pin_price> <ind_active>1</ind_active> <CreateOn>2009-07-16T00:00:00+05:30</CreateOn> </PinType_TABLE> </NewDataSet>

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      Just i would like to clerify you query that are facing problem with the date formate while you are converting XML file into excel file ?

      Parwej Ahamad ahamad.parwej@gmail.com

      1 Reply Last reply
      0
      • R rummer

        How we get XML tag value in MM/DD/YYYY format in .net with c# ?? private string getXmlTagDate(XmlElement xEle, string name) { XmlNodeList xList; string text; xList = xEle.GetElementsByTagName(name); if (xList.Count > 0) { text = xList[0].InnerText.ToString(); text = Convert.ToDateTime(text).ToShortDateString(); } else { text = "00/00/0000"; } return text; } this function work properly for text value and we get this in date format <?xml version="1.0" standalone="yes"?> <NewDataSet> <PinType_TABLE> <pinname>HALF UNIT</pinname> <fullvalue>12000</fullvalue> <percent_value>50</percent_value> <pin_type>P</pin_type> <pin_price>6000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-02-01T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>Full</pinname> <fullvalue>12000</fullvalue> <percent_value>100</percent_value> <pin_type>P</pin_type> <pin_price>12000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-02-03T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>fourth unit</pinname> <fullvalue>12000</fullvalue> <percent_value>25</percent_value> <pin_type>P</pin_type> <pin_price>3000</pin_price> <ind_active>1</ind_active> <CreateOn>2009-05-21T00:00:00+05:30</CreateOn> </PinType_TABLE> <PinType_TABLE> <pinname>s.s</pinname> <fullvalue>12000</fullvalue> <percent_value>0</percent_value> <pin_type>P</pin_type> <pin_price>0</pin_price> <ind_active>1</ind_active> <CreateOn>2009-07-16T00:00:00+05:30</CreateOn> </PinType_TABLE> </NewDataSet>

        K Offline
        K Offline
        keyur satyadev
        wrote on last edited by
        #3

        rummer wrote: text = Convert.ToDateTime(text).ToShortDateString(); text= Convert.ToDateTime(text).Tostring("MM/dd/yyyy");

        Regards Keyur Satyadev

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups