none
Date/ Time XML Extraction in SSRS

    Question

  • Hi

    I have a header row in an SSRS report which has the time in it.

    The time needs to be formatted as hhmmss and the expression I am using is =Now.ToString("HHmmss").

    When I extract this as csv, the time comes out as expected e.g. 102730 but when I extract this as XML (which is the format I need the extract to be in) it comes out formatted as 10:27:30

    Can anyone advise on how I can extract the time as 102730 as xml?  I assumed that the expression would work in all formats.

    Thanks

    Thursday, January 16, 2014 10:30 AM

Answers

  • Hi dev-13,

    After testing the expression in my environment, it works well when export to XML. So I cannot reproduce this issue, and I couldn’t find the reason why it is formatted as HH:mm:ss when export the report to XML in your environment.

    In order to achieve the similar functionality, we can refer to the expression below:
    =Format(Now(),"hhmmss")
    Or
    =Replace(TimeString(),":","")

    Hope this helps.

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Friday, January 17, 2014 8:00 AM

All replies

  • try converting it to integer value

    =Cint(Now.ToString("HHmmss"))


    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    Thursday, January 16, 2014 11:43 AM
  • Hi dev-13,

    After testing the expression in my environment, it works well when export to XML. So I cannot reproduce this issue, and I couldn’t find the reason why it is formatted as HH:mm:ss when export the report to XML in your environment.

    In order to achieve the similar functionality, we can refer to the expression below:
    =Format(Now(),"hhmmss")
    Or
    =Replace(TimeString(),":","")

    Hope this helps.

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Friday, January 17, 2014 8:00 AM