By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,572 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,572 IT Pros & Developers. It's quick & easy.

Format date using user defined format

P: n/a
Sun
Hi,

I display date in asp.net pages using user defined format: mydate.text=Format(dr("MyDate"), "MMM. d, yyyy"). It works fine for all pages except one.

In that page, I built a dataAdapter, filled a dataset and then I did:
If (ds.Tables("relo").Rows.Count > 0) Then
dr = ds.Tables("relo").Rows(0)
If (Not IsDBNull(dr("File Open Date"))) Then
initialdate.Text = Format(dr("File Open Date"), "MMM. d, yyyy")
End If
End If
When the page loads, it did not display the real date. Rather, it displayed MMM. d,yyyy for any real date.

There is nothing special on that page. One thing that might affect it is that later I bind the datatable to a repeater:
Repeater1.DataSource = ds.Tables("relo")
Repeater1.DataBind()

Would that be the problem?

Thanks!
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sun,

What do you mean by 'any real date'?
Also, did you try to run the page without the formatting to check the dates
you have in the dateset?

Telmo Sampaio

"Sun" <Su*@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
Hi,

I display date in asp.net pages using user defined format: mydate.text=Format(dr("MyDate"), "MMM. d, yyyy"). It works fine for all
pages except one.
In that page, I built a dataAdapter, filled a dataset and then I did:
If (ds.Tables("relo").Rows.Count > 0) Then
dr = ds.Tables("relo").Rows(0)
If (Not IsDBNull(dr("File Open Date"))) Then
initialdate.Text = Format(dr("File Open Date"), "MMM. d, yyyy") End If
End If
When the page loads, it did not display the real date. Rather, it displayed MMM. d,yyyy for any real date.
There is nothing special on that page. One thing that might affect it is that later I bind the datatable to a repeater: Repeater1.DataSource = ds.Tables("relo")
Repeater1.DataBind()

Would that be the problem?

Thanks!

Nov 20 '05 #2

P: n/a
Hi Sun,

You know this statement?
mydate.text=dr("MyDate").ToString("MM/dd/yyyy")

Assuming that date is a datetime column

Cor
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.