Click here to Skip to main content
16,012,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi developer
My csv file contain the date format as 23.4.2010 as dd.mm.yyy but I want that a date format can be like this 23/4/2010 as mm/dd/yyyy


Datagidview1= System.Globalization.DateTimeFormatInfo.CurrentInfo.DateSeparator

or

Datagridview1.Columns[7].DefaultCellStyle.Format = System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern;


this code is not work

I want to take a format that apply on all the columns that contain a date. and when csv file load , date format automatically applied . not on index number. because I have no more Confident that all the values always at their particular cell position.


so please so my problem by solve this code problem
Posted
Updated 25-Nov-10 7:57am
v2

1 solution

What do you do to select those data into the csv file?

You can use

dateTime.ToString("mm/dd/yyyy");


and export the string value to your CSV file.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900