A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Links and Linking
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Issue in date formats



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2004, 10:16 AM
Devesh Aggarwal
external usenet poster
 
Posts: n/a
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  
Old June 1st, 2004, 12:37 PM
Norman Jones
external usenet poster
 
Posts: n/a
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




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:29 PM.


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