Menu

Request Change For Other Century Calendra

Leng
2004-08-30
2004-09-01
  • Leng

    Leng - 2004-08-30

    CMsSqlDatabase.vb
        Public Overrides Function getValueFor(ByVal tempValue As Object) As String
    .
    .

                    Case VariantType.Date
                        ' Started Modified By cpf.co.th
                        Dim OriginalCulture As System.Globalization.CultureInfo
                        Dim TempCulture As System.Globalization.CultureInfo
                        TempCulture = New System.Globalization.CultureInfo("en-US")
                        OriginalCulture = System.Threading.Thread.CurrentThread.CurrentCulture
                        System.Threading.Thread.CurrentThread.CurrentCulture = TempCulture
                        System.Threading.Thread.CurrentThread.CurrentUICulture = TempCulture
                        ' End Modified By cpf.co.th

                        dd = CType(tempValue, DateTime)
                        If dd = Date.MinValue Then
                            tempRetorno = "NULL"
                        Else
                            If dd.Date.Ticks = 0 Then
                                'MSSQL doesn't support dates with years less than 1753, so time only
                                'values that format to "0001-01-01 11:23:00" for example produce errors.
                                'If it's just a time we will only return time portion.
                                tempRetorno = "'" & dd.ToString("HH:mm:ss") & "'"
                            Else
                                tempRetorno = "'" & dd.ToString("yyyy-MM-dd HH:mm:ss") & "'"
                            End If
                        End If

                        ' Started Modified By cpf.co.th
                        System.Threading.Thread.CurrentThread.CurrentCulture = OriginalCulture
                        System.Threading.Thread.CurrentThread.CurrentUICulture = OriginalCulture
                        ' End Modified By cpf.co.th

    Thank you

     
    • Richard Banks

      Richard Banks - 2004-08-31

      Hi Leng,

      I'm not sure what problem you are trying to fix.  The dates are generated in a specific format that MSSQL server want and there is no locale specific code (that I am aware of) so why do you need to set the culture information?

      - Richard.

       
      • Nobody/Anonymous

        I'm not sure to specific this point Because My colleague has found Its in where condition for createdDate and ModifiedDate.
        It's Translated Year to 2547 instead 2004

        My Config Server
        - Sql Server 2000 Default Language British English this year is 2004
        - Asp.net th-TH (not sure) this year is 2547 (sure)

         
    • Richard Banks

      Richard Banks - 2004-08-31

      Ah, I see!  It's used the Thai year, not the US year.  The same problem could easily occur in other locales as well.

      OK.  I'll have a look at the code in more detail and make changes to the other db providers as well.

      Thanks :-)

      Richard.

       
    • Richard Banks

      Richard Banks - 2004-09-01

      The code has been changed and CVS updated.

      Once again, thanks for the fix :-)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.