简体   繁体   中英

DatetimePicker automatic conversion C#

I am using C# and I am setting the value of the date time picker to my date from my database. But the format I have in database is different from the format of the Date Time Picker. Is there a way to automatically change the format of my database date to that of the date time picker. I have searched for it but I haven't found it.

I will appreciate your help.

But the format I have in database is different from the format of the Date Time Picke

You are making the mistake of thinking the database has any associated display format when storing a DATETIME - it doesn't - there is an internal representation. All you see is how the date is represented when you view it in some tool.

If your database uses a DATETIME column, as it should, then there is not issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM