locked
FileHelperEngine DateTime Conversion Error RRS feed

  • Question

  • I am getting an datatime error conversion when I load the csv file through filehelperengine. Could someone help me. Review screen shot below. The format in my csv file 12/5/2015

     [FieldOptional]
            [FieldNullValue(typeof(DateTime), "1/01/1000 00:00:00")]
            private DateTime mperiodStart;

            public DateTime periodStart
            {
                get { return mperiodStart; }
                set { mperiodStart = value; }
            }

            [FieldOptional]
            [FieldNullValue(typeof(DateTime), "1/01/1000 00:00:00")]
            private DateTime mperiodEnd;


    pianoboyCoder


    • Edited by pianoboyCoder Wednesday, December 23, 2015 12:30 PM
    • Moved by CoolDadTx Wednesday, December 23, 2015 3:39 PM Third party product
    Wednesday, December 23, 2015 12:06 PM

Answers

  • These forums are for MS products only.  Please post questions related to third party products like FileHelperEngine in their forums.
    • Proposed as answer by Just Karl Wednesday, December 23, 2015 6:19 PM
    • Marked as answer by Just Karl Friday, January 8, 2016 9:56 PM
    Wednesday, December 23, 2015 3:39 PM

All replies

  • your data 12/5/2015

    your mask ddMMyyyy

    In mask dont have /

    Try replace("/1/","01"), replace("/2/","02") ... replace("/12/","12") before convert.

    Or 

    CultureInfo provider = CultureInfo.InvariantCulture;
    Convert.ToDateTime("12/5/2015",provider);

    Wednesday, December 23, 2015 12:44 PM
  • How to place this in the file below, mean place it in the attribute itself.

    CultureInfo provider = CultureInfo.InvariantCulture;
    Convert.ToDateTime("12/5/2015",provider); 

    HOw would i place in the properties below

    [FieldOptional]
            [FieldNullValue(typeof(DateTime), "1/01/1000 00:00:00")]
            private DateTime mperiodStart;

            public DateTime periodStart
            {
                get { return mperiodStart; }
                set { mperiodStart = value; }
            }

            [FieldOptional]
            [FieldNullValue(typeof(DateTime), "1/01/1000 00:00:00")]
            private DateTime mperiodEnd;


    pianoboyCoder

    Wednesday, December 23, 2015 1:50 PM
  • These forums are for MS products only.  Please post questions related to third party products like FileHelperEngine in their forums.
    • Proposed as answer by Just Karl Wednesday, December 23, 2015 6:19 PM
    • Marked as answer by Just Karl Friday, January 8, 2016 9:56 PM
    Wednesday, December 23, 2015 3:39 PM