It's been an issue with me for a wHILE - when I'm looking to do formatting of dates in vb.NET, I always get lost and waste time! Well I've found a site that's GREAT for information.
The site from Macon State College - here it is.
To be honest, that site has functionality in its raw form as relies on the Microsoft.VisualBasic namespace (DLL), a now outdated namespace. So, even though I support that site I think you should more use the following formats when dealing with dates...
Assume you wanted to format #12/30/07# from that dirty US date format... (Also assume "aDate = #12/30/2007#"), you'd do the following:
aDate.ToString("dd-MMM-yyyy") 'which would give 30-Dec-2007 as a nice string.
And what if you wanted to format times?
Now.ToString("dd-MMM-yyyy hh:mms tt") 'gives 02-Mar-2007 06:45:15 PM
There you'd recognise that the "tt" gives AM or PM, which ever is relevant. Rather cool instead of using any 24 hour format!
Anyway, enough on that for now but definitely check that site, I'm using this blog post as a Bookmark to it also!
tagged: professional // Comments [0]
Related posts:Select a random row in MS SQL...Regular expressionsVS2005, ASP.NET 2 & DLLs, DLLs..MS's ASP.NET and.. PHP2-way databinding cascading drop down lists within a FormViewApplicationName Property when customising providers
Disclaimer The posts on this blog are provided "AS IS" with no warranties. The opinions expressed herein are my own personal opinions and do not represent any other person's views in anyway.