Format date using user defined format

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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 said:
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:
 
Hi Sun,

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

Assuming that date is a datetime column

Cor
 
Back
Top