none
Date handling Issues in VS 2015

    Question

  • We are doing development on VS 2015 (trying to upgarde from VS 2012), with IBM DB2 as the backend.

    We are facing the following issue:

    We need DD/MM/YYYY as the date format...but VS 2015 seems to automatically convert it to MM-DD-YYYY. Consequently, when the date crosses 13th...it throws an exception and crashes the application. We were handling this without any issues in VS 2012.

    The following is the exception:

    "An exception of type 'IBM.Data.DB2.DB2Exception' occurred in App_Code.hrtlfgyo.dll but was not handled in user code"


    SQL0035N  The file "C:\Users\%\msg\en_US\db2nmp.xml" cannot be opened."

    Please do help, else we will have to change codes in a few thousand forms!

    Monday, May 23, 2016 5:57 AM

Answers

  • You need to show the code you are using before suggestions can be made.

    For example the code where you try to insert the Date.

    Also, the Date format depends on your location, so some formatting may be needed:

    This is some quick formatting examples:

    and the code:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim ThisIsTheDate As Date
    
            ThisIsTheDate = Date.Now
            RichTextBox1.AppendText("The Date                        :" & vbTab & ThisIsTheDate & Environment.NewLine)
            RichTextBox1.AppendText("The Date formatted (MM/dd/yy)   :" & vbTab & ThisIsTheDate.ToString("MM/dd/yy") & Environment.NewLine)
            RichTextBox1.AppendText("The Date formatted (MM-dd-yyyy) :" & vbTab & ThisIsTheDate.ToString("MM-dd-yyyy") & Environment.NewLine)
            RichTextBox1.AppendText("The Date formatted (M dd yyyy)  :" & vbTab & ThisIsTheDate.ToString("M dd yyyy") & Environment.NewLine)
            RichTextBox1.AppendText("The Date formatted (dd;MM;yyyy)  :" & vbTab & ThisIsTheDate.ToString("dd;MM;yyyy") & Environment.NewLine)
        End Sub

    Monday, May 23, 2016 9:04 AM