Monday, April 17, 2006

If you're still formatting dates as such:

lblDate.text = datepart("d",Now) & "/" & datepartt("m",now) & "/" & datepart("yyyy",now)

then stop this instant!  Step away from the keyboard and no one gets hurt.

There are better ways in ASP.NET to format dates.  You could replace the above line of code with:

lblDate.text = getdate().tostring("MM/dd/yyyy")

and end up with exactly what you needed.  ASP.NET is full of great format strings.  Remmeber the old FormatCurrency(MyCash) command?  You can replace that with MyCash.ToString("C").  Download the .NET 2.0 SDK and look up "formatting strings"; you'll find all these goodies in there.

Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):