controlling date formats in control panel

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.




Answer this question

controlling date formats in control panel

  • Mark3308

    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...


  • Anjo Gasa

    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.


  • ACCOUNTINGONLINE.US

    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.



  • DixieDog

    It is actually a typed dataset.

  • KAllbritain

    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.



  • Tryst

    Make sure the column type of the database table is datetime, not varchar.


  • igorbaITALY

    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.



  • JonathanDevelopper

    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



  • Snickel65

    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.)

     



  • controlling date formats in control panel