error with the datetimepicker when moving to another [closed] PC

0

When I move to another computer my datetimepicker program in a short date format comes out as '20 / 09/2017 'but on my computer it goes out as '20 / 09/17' and the programming is in this format so when I put to look for or make a query does not match the date, use sqlserver and visual studio 2010.

    
asked by Alfredo Jimenez Palacios 20.09.2017 в 12:23
source

1 answer

4

The DateTimePicker control, if you set the value Short to the property Format , will be formatted as the short date format set in the computer's regional settings.

You can force it to have the same format regardless of the computer and its locale by setting the property Format as Custom and specifying in the property CustomFormat the format to be used, for example "dd/MM/yy" for your case.

In any case, the format in which the dates are displayed should not affect the code of your application. The dates should be handled in variables of date data type and not as chains. They should only be converted to chains to show them to the user (on the screen, reports, ...) but not when handling them in your code (for example to filter data).

    
answered by 20.09.2017 / 12:36
source