XML DateTime conversion in C#

I have an XML document where the datetime format is;
"Wed May 08 2007 00:00:00 GMT-0600" and I need to convert it in C# to any DateTime as long as it works in C#....Help Please Andy

Try:
SELECT CONVERT(varchar,CONVERT(smalldatetime, '3/22/2010 4:28:23 PM', 101),101)+
SPACE(1)+
LEFT(CONVERT(varchar,CONVERT(smalldatetime, '3/22/2010 4:28:23 PM', 101),108),5);
-- 03/22/2010 16:28
Datetime conversions:
http://www.sqlusa.com/bestpractices/datetimeconversion/
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • DATE vs DATETIME conversion

    I am running into a strange issue which is preventing me to finish my project. Any help would be greatly appreciated. 
    It looks like the CONVERT (the same goes for CAST) function treats DATE and DATETIME conversions differently when executed by a user with the Dutch language settings.
    Here is what I mean, I run the following query:
    SELECT CONVERT(DATE, '2014-09-01 23:00:00'), CONVERT(DATETIME, '2014-09-01 23:00:00')
    The results are:
    2014-09-01, 2014-01-09 23:00:00
    The conversion to DATETIME swapped the month and the day around, while this doesn't happen for the DATE conversion. The DATE conversion is the correct format, since I supplied it YYYY-MM-DD HH:mm:ss.
    When I run the same query using a user with the default language settings (en-US I assume) the same query works fine (no swapping of month and day values). 
    Can someone explain why this is happening? And maybe more important how to prevent it or workaround it (changing the language for the user from Dutch to default is not an option)? 
     

    >> Can someone explain why this is happening? And maybe more important how to prevent it or workaround it (changing the language for the user from Dutch to default is not an option)? <<
    CONVERT() is an old Sybase string function. It was created to keep 960's COBOL programmers happy since SQL does not have a PICTURE clause to put data in display formats. 
    CAST() is the ANSI/ISO Standard function to convert data types and this is what you should be using. It is not a string function. It uses the ISO-8601 standard for dates (yyyy-mm-dd), as you have seen. This is the only -– repeat, only! -- format allowed in
    SQL. Microsoft is a few decades behind and trying to catch up now.
    A good SQL programmer will do any local display formatting in the presentation, which will handle local languages that are never used in the database. Want to have some fun? The names of months in Polish, Czech, Croatian, Ukrainian and Belarusian not based
    on the Latin names used in most European languages. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • PARSE_APPLICATION_DATA Error during XML = ABAP conversion: Response Message; CX_ST_DESERIALIZATION_ERROR in /1SAI/SAS0446CC11CC6EC1AD4789 Line 24 An error occurred when deserializing in the simple transformation program /1SAI/SAS0446CC11CC6EC1AD4789

    Hi Experts ,
    i have a scenario proxy to soap  where i am getting error while getting the response .
    we are sending the request successfully and getting response .some times we are getting in proxy level error below
    PARSE_APPLICATION_DATA Error during XML => ABAP conversion: Response Message; CX_ST_DESERIALIZATION_ERROR in /1SAI/SAS0446CC11CC6EC1AD4789 Line 24 An error occurred when deserializing in the simple transformation program /1SAI/SAS0446CC11CC6EC1AD4789 (Cha
    Please help us to fix this bug in proxy response.
    Regards
    Ravi

    Hello Ravinder,
    Can you please post the complete stack trace, it seems to be some fields are getting truncated i,e data sent from the program to the proxy object might be violating some length restrictions.
    Please check your message interface field lengths and what is being passed to the proxy.
    Regards,
    Ravi.

  • XML IDoc conversion: No known segments identified

    Hi all,
                     am working on a File to IDoc scenario. In runtime, error occurs at Call Adapter phase.
    <SAP:Category>XIAdapter</SAP:Category>
      <SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_METADATA</SAP:Code>
      <SAP:P1>XML IDoc conversion: No known segments identified</SAP:P1>
    Can anyone help me in diagnosing.
    Thanks,
    Chilanka

    Hi,
    This issue wis not with Mapping.
    The issue is that the utout of the mapping does not confirm to the Idoc metadata,
    Exactly why I want to look at the output of the mapping.
    Regards
    Bhavesh

  • StrictXml2PlainBean - to have an XML - EDI conversion?

    Dear Experts,
    I'm experimenting with the EDIFACT XML --> EDIFACT conversion in XI. As we already know, there is no "out of the box" solution for it from SAP itslef. That's why we have to use a 3rd party solution for this conversion. (e.g. Seeburger, ACTIS, conversion agent,...)
    But what about the StrictXml2PlainBean adapter module?
    In this docu I read that it's good for XML to plain text conversions:
    http://help.sap.com/saphelp_nw04/helpdata/en/44/748d595dab6fb5e10000000a155369/content.htm
    Do you have any experience with this?
    Is it OK for this kind of complex tasks or is it just an alternative for the File adapter's file content conversion funcionality?
    Any comments/experiences are welcome!
    Thank you in advance!
    Andras

    <i>But what about the StrictXml2PlainBean adapter module?</i>
    >>>
    this module is very similar to what we have as FCC in the file adapter. But for complex structure like EDIFACT, i dont think it can be of much use.

  • Error in IDOC: XML IDoc conversion: No known segments identified

    Hi Team
    i am facing error in my scenario.  When we are testing my  interface, another  Interface is picking up the Messages and resulting into an error.
    There is no mapping involved in my scenario.
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>XIAdapter</SAP:Category>
      <SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_RUNTIME</SAP:Code>
      <SAP:P1>XML IDoc conversion: No known segments identified</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>Error: XML IDoc conversion: No known segments identified</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    please help me out
    thanx in advance

    Hi,
      Do The following:
    1) Delete the IDX2 entry and try to reimport once again....and in the IR also do the same.
    2) Have a look into this SAP Note- 742093
    3) Check the IDX1 entry , RFC destination entry... may be not pointing correctly.
    4) If any field which is mandatory in the idoc must not be disabled...take care about it.
    Hope this will help you...
    Regds,
    Pinangshuk.

  • Error during XML = ABAP conversion

    Hi
      We have a synchronous call from a SRM application through a proxy framework to a vendor http server through XI. The response from the vendor's http server is returned through a custom structure -and is returned through XI back to the calling SRM application.
    After receiving the response, the calling SRM application checks for a particular field value of the custom return structure for a error code and sends out an email - accordingly.
    Now, the response message comes back from the vendor's server - but the lines of code beyond the synchronous call in the SRM calling application does not get executed ( mail generation part ) I get the following error on the SRM front end - <b>Error in Exchange Infrastructure: Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT; (/1SAI/TXS00000000000000000001 XML Bytepos.: 39 XML Path: Error Text: System e</b>
    Now, this error when occured in our dev environment, I set the extended xml attribute property to 'X' for the synchronous payload in calling SRM application code. The problem is, this error is occuring now in our QA environment inspite of this property being set.
    Any ideas/suggestions as to why this message occurs in a standard proxy framework setup ?

    Hi,
       Please check this link <a href="http://help.sap.com/saphelp_nw04/helpdata/en/0c/402040abf2c442e10000000a1550b0/content.htm"></a>
    This talks about having the first element of the xml fragment as X0.
    Hope this helps.
    Regards,
    Smitha.

  • Error during XML = ABAP conversion, empty tag

    Hi.
    Im sending data from a Data Base to a proxy using BI.
    But when I get an empty response from the data base wich gives me an empty XML tag the proxy shows me an error:
    -PARSE_APPLICATION_DATA Error during XML => ABAP conversion (Response  Message; error ID: CX_ST_MATCH_ELEMENT;
    -Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
    -System expected the end of the element 'STMT_DC_response'          
    This is the message that originates the fail:
    <?xml version="1.0" encoding="utf-8" ?>
    <ns0:MT_PRV23_BS_desg_response xmlns:ns0="urn:tompla-com:xi:ventas_SD">
    <STMT_response>
      <row>
       <TIPO>P</TIPO>
       <NUM_OT>55062330</NUM_OT>
       <NUM_DESGLOSE>1</NUM_DESG>
       <CANT_DESG>1724000</CANT_DESG>
      </row>
    </STMT_response>
    <STMT_DC_response />
    </ns0:MT_PRV23_BD_desg_response>
    In case that the tag is filled runs ok
    <?xml version="1.0" encoding="utf-8" ?>
    <ns0:MT_PRV23_BD_desg_response xmlns:ns0="urn:tompla-com:xi:ventas_SD">
      <STMT_response>
       <row>
        <TIPO>P</TIPO>
        <NUM_OT>55062330</NUMERO_OT>
        <NUM_DESG>1</NUM_DESG>
        <CANT_DESG>1724000</CANT_DESG>
       </row>
      </STMT_response>
      <STMT_DC_response>
       <row>
        <TIPO>P</TIPO>
        <NUMERO_OT>55062330</NUMERO_OT>
        <NUMERO_DESGLOSE />
        <COD_CAR_ADICIONA>8</COD_CAR_ADICIONA>
        <PORC_CAR_ADICION>1</PORC_CAR_ADICION>
      </row>
      </STMT_DC_response>
    </ns0:MT_PRV23_BD_desg_response>
    The definition for the data is:
    STMT_DC_response        0..1
      row                               0..n
        tipo                             0..1
    Thanks for the help you can give me about my problem with empty tags.

    I moved this question to other forum
      Expert Forums  » SAP NetWeaver  » Exchange Infrastructure 

  • XML - ABAP conversion, empty tag

    Hi.
    Im sending data from a DB to a proxy using XI.
    But when I get an empty response from the DB, wich gives me an empty XML tag the proxy shows me an error:
    -PARSE_APPLICATION_DATA Error during XML => ABAP conversion (Response  Message; error ID: CX_ST_MATCH_ELEMENT;
    -Error during XML => ABAP conversion (Response Message; error ID: CX_ST_MATCH_ELEMENT;
    -System expected the end of the element 'STMT_DC_response'          
    This is the message that originates the fail:
    <ns0:MT_xxx_response xmlns:ns0="urn:s-com:xi:SD">
    <STMT_response>
      <row>
       <c11>P</c11>
       <c12>55062330</c12>
       <c13>1</c13>
      </row>
    </STMT_response>
    <STMT_DC_response />
    </ns0:MT_xxx_response>
    In case that the tag is filled runs ok
    <ns0:MT_xxx_response xmlns:ns0="urn:s.com:xi:SD">
      <STMT_response>
       <row>
        <c11>P</c11>
        <c12>55062330</c12>
        <c13>1</c13>
       </row>
      </STMT_response>
      <STMT_DC_response>
       <row>
        <c21>P</c21>
        <c22>55062330</c22>
        <c23 />
      </row>
      </STMT_DC_response>
    </ns0:MT_xxx_response>
    The definition for the data is:
    STMT_DC_response        0..1
      row                               0..n
        tipo                             0..1
    Thanks for the help you can give me about my problem with empty tags.

    thanks for your help!
    yes, The definition for the data is:
    STMT_DC_response    0..1
    to be sure I disabled that node, so I wont get it from the DB, and It was ok
    this is ok:
    <ns0:MT_xxx_response xmlns:ns0="urn:s-com:xi:SD">
    <STMT_response>
    <row>
    <c11>P</c11>
    <c12>55062330</c12>
    <c13>1</c13>
    </row>
    </STMT_response>
    </ns0:MT_xxx_response>
    but this is not
    <ns0:MT_xxx_response xmlns:ns0="urn:s-com:xi:SD">
    <STMT_response>
    <row>
    <c11>P</c11>
    <c12>55062330</c12>
    <c13>1</c13>
    </row>
    </STMT_response>
    <STMT_DC_response />
    </ns0:MT_xxx_response>

  • XML = ABAP conversion error (CX_ST_GROUP_MISSING_CASE)

    Hi ,
    we are using wsdl connection
    We are not able to display data in SAP
    its showing error :
    Error during <b>XML => ABAP conversion</b> (Response Message; error ID: CX_ST_GROUP_MISSING_CASE; (/1SAI/TXS00000000000000000010 XML Bytepos.: 205 XML Path: root(1)ns0:requestEventResponse(1) Error Text: Element 'TESTRESPONSE' missing))

    Are you by any chance using a message interface with multiple namespaces as source for your ABAP proxy? I am currently facing the very same problem and my best guess so far is that the ABAP proxy cannot handle multiple namespaces in one message.
    Did you get open a ticket on SapOSS? Any hints are very welcome!
    Stefan

  • IDOCType PORDCR101 : XML IDoc conversion: No known segments identified

    Hello all,
    I'm strugling with the mapping to the IDOC create puchase order PORDCR1.PORDCR101.
    The source structure for the moment is exactly the same as the target strcuture i.e. our IDOC.
    So I would not expect to much problems with this one.
    However, when sending the message we get the following error in SXI_MONITOR:
    <SAP:Category>XIAdapter</SAP:Category>
      <SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_RUNTIME</SAP:Code>
      <SAP:P1>XML IDoc conversion: No known segments identified</SAP:P1>
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Error: XML IDoc conversion: No known segments identified</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
    I also augmented the trace lvl to 3 and got the following in the Trace-part of TC SXI_MONITOR and
    suspect it starts to get wrong already in the beginning
    - <!--  ************************************
      -->
      <Trace level="1" type="T">----
    </Trace>
      <Trace level="1" type="T">---- Outbound IDoc-Adapter -
    </Trace>
      <Trace level="1" type="T">----
    </Trace>
    Trace level="1" type="T">Convert one IDoc</Trace> .
      <Trace level="2" type="T">Convert Control Record</Trace>
      <Trace level="2" type="T">Convert Data Records</Trace>
      <Trace level="3" type="T">Segment= E1BPMEPOHEADER</Trace>
      <Trace level="2" type="T">Ignore unknown Segment E1BPMEPOHEADER</Trace>
      <Trace level="2" type="T">Ignore segment field: COMP_CODE</Trace>
      <Trace level="3" type="T">Segment= E1BPMEPOHEADERX</Trace>
      <Trace level="2" type="T">Ignore unknown Segment E1BPMEPOHEADERX</Trace>
      <Trace level="3" type="T">Segment= E1BPMEPOADDRVENDOR</Trace>
      <Trace level="2" type="T">Ignore unknown Segment E1BPMEPOADDRVENDOR
    I already found the four or so other threads on the SDN website about this error and in the mean-time tried them (delete and reload the structure with IDX2, set the begin and segment-attribute to 1, make sure that the segments-names self are also mappend) but to no avail.
    We just implemented two other IDOC's (DELVRY03 and WMMBID02) and they arrive at SAP without problmens.
    Hope you have form ideas to get me out of this one.
    Tnx and best regards.
    Bart.

    Hi Bart,
    We had a similar problem.... It took us 2 days to find out what the problem was... Nothing on SDN was helpfull so far... First we incremented the trace level of XI to see the debug messages... Then we saw that certain segments could not be identified and are ignored, others not...
    So further investigation in IDX2 to the specific IDoc with problems showed us a list with all used segments and their versions. Some segments had only 1, others had more versions....
    So we could identify the problem as a segment version problem. It seemed that our IDoc Communication Channel took not the most recent version. So we changed the "Segment Version" to the most recent one and the problem was solved!
    Please reward points if this was usefull to you...
    cheers!
    Pedro

  • XML IDoc conversion: No known segments identified PPCC2PRETTICKET01

    Hello to everybody,
    I'm working with JDBC adapter to IDOC scenario with standard message PPCC2PRETTICKET01 and I found this message:
    IDOC_ADAPTER">ATTRIBUTE_IDOC_RUNTIME
    XML IDoc conversion: No known segments identified
    I've read previous thread and I've already try to Reimport the Idocs into Repository
    and Delete the Idoc metadata from the in Transaction IDX2 and reimport the same.
    I'm in SAP NetWeaver 2004s.
    Do you have another ideas?
    Many thanks

    Hi,
    I've filled up control record in message mapping, I tried with Apply C R but it doesn't work.
    I don't know how to disable EDI_DC40 in message mapping because the fields are red.
    I've filled up every segment field with a constant with the right segment name but nothing.
    This is the payload after the error but since the JDBC adapter in:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <PPCC2PRETTICKET01>
    - <IDOC BEGIN="1">
    - <EDI_DC40 SEGMENT="EDI_DC40">
      <TABNAM>EDI_DC40</TABNAM>
      <DIRECT>2</DIRECT>
      <IDOCTYP>PPCC2PRETTICKET01</IDOCTYP>
      <MESTYP>PPCC2PRETTICKET</MESTYP>
      <SNDPOR>SAPXI0</SNDPOR>
      <SNDPRT>LS</SNDPRT>
      <SNDPRN>XIDEV100</SNDPRN>
      <RCVPOR>SAPDEV</RCVPOR>
      <RCVPRT>LS</RCVPRT>
      <RCVPRN>SYSDEV300</RCVPRN>
      </EDI_DC40>
      </IDOC>
      </PPCC2PRETTICKET01>
    Thank for more ideas.
    Fabrizio

  • XML dateTime type with timezone info.

    Has anyone have problem FTPing xml that conforms to a xml schema with dateTime type?
    This is the format of standard XML dateTime type:
    "2003-12-17T09:30:47-05:00"
    I used the Oracle timestamp datatype, but oracle rejected the dateTime of XML with the error message
    "ORA-01830: date format picture ends before converting entire input string."
    I have altered the database to use timezone information:
    // For eastern time zone.
    alter DATABASE SET time_zone = 'Etc/GMT-5';
    and use the native oracle datatype
    "TIMESTAMP WITH TIME ZONE"
    but still doesn't work. I also changed the XML time data to "2003-12-17 09:30:47-05:00", still no good.

    I tried couple formats, they all seem to need the "T" in between date and time. If I don't have the "T", I get the error message "ORA-01861: literal does not match format string"
    If I use the following input I get the error message
    "ORA-31041: Property CreateDate: Memory type (180) not compatible with database type (121)"
    "2003-12-11T21:30:47.0"
    "2003-12-11T21:30:47.000000"
    "2003-12-11T21:30:47.000000000"
    "2003-12-11T21:30:47000000"
    "2003-12-11T21:30:470000"
    If I use the following I get error message "ORA-01830: date format picture ends before converting entire input string"
    "2003-12-11T21:30:470000-04:00"
    "2003-12-11T21:30:47.000000-05:00"
    "2003-12-11T21:30:47.0-05:00"
    It leads me to think that "2003-12-11T21:30:47.000000"
    is the picture(mask) used by the database. But it has extra "T" in it, and oracle doesn't understand the datatype. Maybe there are two validation going on? one from schema and another during insertion to database? Schema requires "T", but database doesn't understand "T"?
    Am I in the right track?
    Do you know how do I query the mask used?
    Thanks,
    --Benjamin                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • XML IDoc conversion: No known segments identified ,only few times

    Hi all,
    Our scenario is in production and is working fine,few times i get the below error.
    This is a Daily run scenario.This week it ran 5 time right and 2 , times it failed  to create Idocs for the same sccenario.
    Can any one help me.
    <SAP:Category>XIAdapter</SAP:Category>
    <SAP:Code area="IDOC_ADAPTER">ATTRIBUTE_IDOC_METADATA</SAP:Code>
    <SAP:P1>XML IDoc conversion: No known segments identified</SAP:P1>
    <SAP:P2 />
    <SAP:P3 />
    <SAP:P4 />
    <SAP:AdditionalText />
    <SAP:ApplicationFaultMessage namespace="" />
    <SAP:Stack>Error: XML IDoc conversion: No known segments identified</SAP:Stack>
    <SAP:Retry>M</SAP:Retry>
    </SAP:Error

    check if these discussions help you:
    XML IDoc conversion: No known segments identified
    IDOCType PORDCR101 : XML IDoc conversion: No known segments identified
    Regards,
    Abhishek.

  • XML - FML conversion

    Hi,
    We want to make use of the XML - FML conversion methods available in weblogic.wtc.gwt; specifically XmlFmlCnv.XMLtoFML32 and XmlFmlCnv.FML32toXML. We cannot find any reference to these in WLS 8.1, the only references found relate to WLS 6.1 (see http://edocs.beasys.co.jp/e-docs/wls61/javadocs/weblogic/wtc/jatmi/class-use/TypedFML32.html
    and
    http://edocs.beasys.co.jp/e-docs/wls61/javadocs/weblogic/wtc/jatmi/class-use/FldTbl.html)
    Are these facilities available in 8.1 for developer use?
    If so can anyone point me to documentation, etc.
    or if not any suggestions as to how we can accomplish such transformation?
    Thanks in advance,
    Malcolm.

    Hi Todd,
    Thanks for the feedback. We had considered the options you suggested; we cannot use the tBridge option because we require a real-time request response operation; and secondly, we require the conversion to occur on the WLS/WTC side rather than within Tuxedo - essentially the simple XML/FML conversion available in tBridge.
    The site currently has a Tuxedo/eLink integration environment. They are introducing WebLogic Integration, and want to use WTC to provide a seamless interconnection between the two integration environments without modifying the Tuxedo side in any significant way.
    Regards,
    Malcolm.

Maybe you are looking for

  • Change text problem CS3

    I am having problems with i2of5 barcode where some of the encoded values for the barcode are the same as InDesign values. e.g. find text "barcode" change text "ËU(K\tÌ" inDesign recognizes the \t for a tab. Is it possible to turn off these keywords o

  • OWB 9.0.4 ability to restart failed ETL jobs ?

    Hi all, Does OWB 9.0.4 provide the ability to restart failed ETL jobs ? For example in a Module of 20 mappings, 15 mappings have completed with success. Mapping 16 fails and hence OWF exists with failure. In the event the problem is rectified can OWB

  • IPhone6 won't connect to Bluetooth

    My iPhone six will not connect to my Bluetooth since I OS 8.3 update. Have turned Bluetooth off, rebooted device, turn Bluetooth back on. It keeps searching but cannot fi have turned Bluetooth off, rebooted device, turn Bluetooth back on. It keeps se

  • App Purchasing Restrictions

    From my understanding there is no way to disable just the ability to purchase paid apps. Whats some options that I have? I would like to have one Apple ID for all the school iPads (students and teachers) but NEED the following... NO purchasing at all

  • 13" MacBook pro vs 11" MacBook air

    Hi guys. I've been looking for a laptop. Like the Pro but it might be heavy. Like the air but no cd/DVD player. Also is it slow because it has 1.6ghz? Using it for essay a little editing and movies/browsing. Help is appreciated