467,894 Members | 1,709 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,894 developers. It's quick & easy.

Format date using user defined format

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
  • viewed: 1210
Share:
2 Replies
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
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.

Similar topics

4 posts views Thread by Jo | last post: by
6 posts views Thread by Dario Di Bella | last post: by
5 posts views Thread by Tim Marsden | last post: by
9 posts views Thread by Coleen | last post: by
9 posts views Thread by David Rysdam | last post: by
20 posts views Thread by andreas | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.