English German Spanish
Support|Education|Careers|Contact Us

Using function Date/Time using output format as 'g' (Short DateTime)

Article ID: 1502
Date Created: 11/03/2010 12:08:18
Date Modified: 16/06/2010 15:21:55
Applies To: XE Mapper
Symptoms: Mapping error
Cause: XE parses the Date and Time format as MM/dd/yyyy HH:mm as this is the standard format of C# en - Whereas format information is misleading and gives the impression it is dd/MM/yyyy HH:mm.
Resolution:

To fix this error, you will require a manual code snippet funtion that will essentially do the same as a function.

To write this code snippet you will need to do the following :-

1. Remove the Function and replace the map connections with a single connector.
2. Select the newly made map connection and click the Code Snippets tab in the bottom left of your screen.
3. Enter the following code :-
try
{
   //Creates function parse
    string strDTM00020 = XE.GetString("#VALUE");
    xedate dtFUNC001;
    dtFUNC001 = xedate.Parse(strDTM00020, "g", DOMAP);
    string strFUNC001 = dtFUNC001.ToString("dd/MM/yyyy HH:mm");
    SRC = Convert.ToString(strFUNC001);
}
catch (Exception ex)
{
    //Logs an error if one is present
    XE.Log("MAP990QE", "An error has occurred in Function 'FUNC001' of type 'DateTime.Convert'");
    //Information inside quotes can be changed
    XE.Log("MAP990RE", "This is connected to 'Target node' '2380 - Date/time/period'");
    XE.Log("MAP990SE", "The reason was...");
    XE.Log("MAP990TE", ex.Message);

    ApplicationException ax = new ApplicationException("Error in DateTime.Convert - see log for details");
    ax.Source = "MAP990UE";
    throw ax;
}
 

More Information:

Tested in build 259

Keywords: DateTime Funtion Error, Could not parse the date-time, Mapper, g format, MAP990TE



Rate this article

12345

Current rating: 0
1 star = Poor, 5 stars = Perfect)

Feedback

Did this information solve your problem?
 
What can we do to improve this information?
 
Please provide an email address so that we can obtain
further information if necessary (optional):




User Logon
Username/Password:
CONTACT US

UK: +44 (0) 1733 371 311
ES: +34 91 268 66 29
SE: +46 (0) 322 935 25
DE: +49 (0) 40 31112 374


sales@di-international.com
Terms and Conditions | Copyright Data Interchange Plc 2012