none
Dates misinterprets with date formats in control panel RRS feed

  • Question

  • HI,

     

    How to control the date format in the control panel. regional settings.

    because when we change the formats in the control panel while the application is running. the date values stores different values. 

    How to prevent this by locking the control panel settings.

    Or to change the values of the date format in the regional settings programmatically. when we start out  application.

    Is this the right syntax for storing dates

    anydatatable("anydatefield")= cdate(format(dtpicker1.value,"dd/MM/yyyy")).

    or simply anydatatable("anydatefield") = dtpicker1.value

    Although set the custom format in the properties, it changes according to the regional settings.

    How to access the .cpl classes.? to work programmatically.

     

     

     

     

    Thanks in advance

    Mohan Raj K.

     

     

    Sunday, August 13, 2006 6:12 AM

All replies

  • Make sure the column type of the database table is datetime, not varchar.
    Sunday, August 13, 2006 10:04 AM
    Moderator
  • It is actually a typed dataset.
    Sunday, August 13, 2006 11:20 AM
  • As long as the table column type is datetime, your dataset member will be of type System.DateTime.  Which makes it independent of the culture or regional format override.  If the table column type is varchar, the dataset member will be of type String.  Which will buy you a lot of trouble someday...
    Sunday, August 13, 2006 11:39 AM
    Moderator
  • NO., it is actually Date datatype only. of oracle database 10g.

    Not only changing. when the date format is set to dd/MM/yyyy in custom format. if, in regional settings M/d/yy. it takes as the value - 07 - jun to 06-July (07/06...to 06/07.  and this happens to only if dates are between 1..12.)

     

    Monday, August 14, 2006 7:11 AM
  • Oh, Oracle.  Hmm, what provider do you use?  Note that MSFT has a dedicated Oracle class library for .NET.  Here's an article that describes it.
    Monday, August 14, 2006 12:57 PM
    Moderator
  • Thanks for your replies.

    I used Oracle Developer Tools for Visual Studio 2005. ( that recently launched.)

    created connection,dataadapters,connection with oracle.dataaccess.client.

    and created typed dataset using the system.data.OracleClient.

    will there by any problems.

    Monday, August 14, 2006 4:08 PM
  •  

    Hi, No,

    Still I getting error with date formats specified in the control panel affects the date fields entered.

     

    actually I am using this for safe, but still i get error. Always use datetimepicker control

     

    to store value I use,like,

     

    dt.rows(0).LOTDATE= cdate(format(dtpicker1.value,"dd/MM/yyyy"))

     

    '-- No Problem If, I have same date format in the control panel,if other than this like M/d/yyyy, then values automatically misinterepreted like 07/06/2007  to 06/07/2007.

     

    for retrieving also the same problem.

     

     

    Please Reply.

     

    '-- updated --

    Hi, Tried also changing the DateTimeMode property in the dataset to UTC. but problem exists.

    Thursday, September 13, 2007 2:55 PM
  • Hi,

     

    It's a request to Forum Members, to please validate the changed date values with the control panel regional settings(esp.INDIAN Settings dd/MM/yyyy), if time permits to you people.

     

    So that it can be clarified.

     

    Thanks in advance for any Efforts.

     

    Mohan Raj k.

     

     

     

     

     

    Monday, November 12, 2007 3:14 PM
  • Use this function:

    Code Block

    Function String2Date(ByVal DDMMYY As String) As DateTime
     
    Return DateTime.Parse(DDMMYY, New System.Globalization.CultureInfo("en-GB"))
    End Function

     

     

    Many people have problem with Date in programming.  For some other date related issues, please visit my blog here:

    http://petersgyoung.spaces.live.com/?_c11_BlogPart_pagedir=Next&_c11_BlogPart_handle=cns!706591A544AC0876!139&_c11_BlogPart_BlogPart=blogview&_c=BlogPart

    Tuesday, November 13, 2007 5:58 AM
  •  

    thanks for your reply(pgyeung).

     

    thanks to MS as listened it and , has accepted the bug, and to change it in next dev10 ctp2 release.

     

    I think it is some what, a 10 year misunderstanding, since the start of win 98. I always advise my customer not to change the settings in the control panel. since, i have been caught in this problem for many times.

     

     

    Tuesday, May 20, 2008 8:32 AM