Question

I am exporting data to .csv file from asp page. I am facing problem in the column which is showing date. Some date comes left aligned and some comes right aligned. As such there is no difference in the dates coming because I am just looping a recordset and writing the rs field which has datetime data.

Note: When I append " " to the datefield then it comes properly but then user cannot format that column to datetime as it no more remains date but a string.

rsDateSet = """ """ rs("AuthorDate") & """," ## This works fine and aligns the column but it converts the column into string so user is not able to format that column to any desired date format he/she wants.

Any helps appreciated.

Thanks

Varun R Doharey

doharey_varun@hotmail.com varundoharey@gmail.com

No correct solution

OTHER TIPS

I assume that your problem is when the CSV is opened in Excel.

Unfortunately, if you use CSV, your data will be interpreted in different ways depending on the locale of the program and the different setting that the user could change.

It is more advisable to use other format, as SpreadSheetML (open format XML) (see my answer about this)

Anyway, on the topic, if you want to be safe, you can use functions in your generated CSV to show dates and numbers like:

  =DATE(2009;10;1)

Or using

  =1234/100

to get the decimal number 12.34

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top