Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.links,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Issue in date formats

I am developing a utility where we need to publish data from an application
hvaing SQL server database to excel. I am doing so. But when i send the data
to excel the date format changes to mm/dd/yyyy even if i am sending it in
dd/mm/yyyy. I have even set the format of that cell as dd/mm/yyyy.

The code i am using to do so is as under:

Dim objDataView As New DataView()
objDataView.Table = objDataSetArray(0).Tables("Condition1")
objDataSetArray(0).Dispose()
If objDataView.Table.Rows.Count 0 Then
'to get total no. of columns
Dim inttotalcol As Int16 = 0
inttotalcol = objDataView.Table.Columns.Count
'********** for general data insertion in excel
**********
For gintII = 0 To objDataView.Table.Rows.Count - 1
For gintInnerLoop = 0 To
objDataView.Table.Columns.Count - 2
objWB.Application.Range(Chr(gintInnerLoop + 66)
& gintJJ).Select()
objWB.Application.Range(Chr(gintInnerLoop + 66)
& gintJJ).BorderAround()

'From this code i m sending Date.
objWB.Application.ActiveCell.FormulaR1C1 =
objDataView.Table.Rows(gintII).Item(gintInnerLoop) .ToString
Next

gintJJ += 1
Next
gintJJ += 1
End If

By this code i m sending data to Excel Sheet. Here i m sending Date in
DD/MM/YYYY fromat. But it is showing in MM/DD/YYYY format in Excel sheet.
Eventhough i did set Format of that perticular column in Excel in
DD/MM/YYYY. I have checked up to last moment date is in DD/MM/YYYY format.

Any suggestions.

Devesh


  #2   Report Post  
Posted to microsoft.public.excel.links,microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Issue in date formats

Hi Devesh,

Try:

Format(objDataView.Table.Rows(gintII).Item(gintInn erLoop).ToString, _
"dd,mm,yyyy")

---
Regards,
Norman

"Devesh Aggarwal" wrote in message
...
I am developing a utility where we need to publish data from an

application
hvaing SQL server database to excel. I am doing so. But when i send the

data
to excel the date format changes to mm/dd/yyyy even if i am sending it in
dd/mm/yyyy. I have even set the format of that cell as dd/mm/yyyy.

The code i am using to do so is as under:

Dim objDataView As New DataView()
objDataView.Table =

objDataSetArray(0).Tables("Condition1")
objDataSetArray(0).Dispose()
If objDataView.Table.Rows.Count 0 Then
'to get total no. of columns
Dim inttotalcol As Int16 = 0
inttotalcol = objDataView.Table.Columns.Count
'********** for general data insertion in excel
**********
For gintII = 0 To objDataView.Table.Rows.Count - 1
For gintInnerLoop = 0 To
objDataView.Table.Columns.Count - 2
objWB.Application.Range(Chr(gintInnerLoop +

66)
& gintJJ).Select()
objWB.Application.Range(Chr(gintInnerLoop +

66)
& gintJJ).BorderAround()

'From this code i m sending Date.
objWB.Application.ActiveCell.FormulaR1C1 =
objDataView.Table.Rows(gintII).Item(gintInnerLoop) .ToString
Next

gintJJ += 1
Next
gintJJ += 1
End If

By this code i m sending data to Excel Sheet. Here i m sending Date in
DD/MM/YYYY fromat. But it is showing in MM/DD/YYYY format in Excel sheet.
Eventhough i did set Format of that perticular column in Excel in
DD/MM/YYYY. I have checked up to last moment date is in DD/MM/YYYY format.

Any suggestions.

Devesh




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date formats Lucretia Excel Discussion (Misc queries) 1 June 26th 07 08:29 PM
Date Formats Denise Excel Discussion (Misc queries) 4 April 4th 07 08:41 PM
Date Formats Amy Excel Discussion (Misc queries) 2 January 23rd 07 05:05 AM
date formats Matt Excel Discussion (Misc queries) 2 May 17th 06 07:52 AM
Date formats JR Excel Discussion (Misc queries) 1 June 1st 05 12:04 AM


All times are GMT +1. The time now is 01:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"