Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1705
What's the best way to format a column that holds a DateTime?
posted

I have a column that will hold times, and I'd like to use the users ShortTimeFormat format.  I see the column has a Format property, and I can put "hh:mm" in it and that works, but it won't be very culture sensitive.  How can I use the user's machine's formats?

  • 469350
    Verified Answer
    Offline posted

     Format just calls ToString on the value of the column and passes in the format. So check the MS Documentation on the DateTime data type and it's ToString method and see what formats it supports. I'm sure there must be a format that allows you to specify the system ShortTime format.