Is your codebehind in C#? If it is, try this:
DataRow row = ...some code ...
String strNewEffDate = row["NewEffDate"].ToString();
DateTime dt = DateTime.Now; // initiliaze dt to current date/time
dt = DateTime.ParseExact(strNewEffDate, "MM/DD/YYYY",
new System.Globalization.CultureInfo("en")); // en - English
culture
String strDateOnly = dt.ToString("MM/DD/YYYY");
...
Console.out.WriteLine("The value is {0}", strDateOnly);
Regards,
Benj
On Apr 21, 1:37 am, Mac222 <[email protected]>
wrote:
> I am fairly new to ASP.NET, but have been using classic ASP for quick
> awhile. I am in the process of building a new website for our company
> using ASP.NET. I am using data extracted from a Microsoft Access
> database and have been successful in retrieving the data in question.
> However, I ran across one small problem. My current code reads:
>
> <%#IIf(Eval("EffDate") <= Container.DataItem("NewEffDate"), _
> Container.DataItem("NewEffDate"), Container.DataItem
> ("EffDate"))%>
>
> The only problem is the 'NewEffDate' and 'EffDate' are both displaying
> the date and time (9/22/2008 12:00:00 AM). The entry in the database
> (ShortDate format) only shows the date.
>
> My problem: How do I suppress the time? I've tried string.format
> ("NewEffDate", {0:d}"), but I get an 'Overload resolution" failed
> message.
>
> Thanks in advance for any assistance I can get.