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
444
How to set current date format in the system to the column format?
posted

Hi I have used the following statement to set the date format of a column in the grid.    grid1.DisplayLayout.Bands(0).Columns("Col1").Format = "MM/dd/yyyy hh:mm:ss"  But I am hardcoding the format here. And if this applicationis run somewhere in UK they would expect dd/MM/yyyy format. So, is there a way I can specify the Format of column to make use of current date format of system. I tried assigning it System's DateTime Format. But they are different in cases which is increasing my code a lot. So what could be my next option to specify Date,Time (12hrs format) of current system?

Thanks,

Sindhu 

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Check out the Microsoft documentation on the ToString method of a DateTime variable. This is all Format does, it call ToString on the value and passes in the format. I'm pretty sure there are formats you can use for things like Short Date or Long Date that will use the current culture settings on the machine.

Children