The site is really maturing. The other day I decided to modify the date formatting for all of the date values on the site, and it was a pretty big job to check every web form and modify the text so "2/2/2007" would read "2007.02.02." I was happy with the result (a bit more "gk" than "halfgk," I suppose) but wasn't too thrilled with all of the edits. This morning I wrote a shared function to take care of these things. Now with a flip of a switch, I can have all of my dates formatted at my whim - as long as my whim is reflected in the function and its associated enum. Public Enum DateFormat DotDelimitedYYYYMMDD = 1 ForwardSlashDelimitedMMDDYYYY = 2 End Enum I'm giving myself two choices for now: "DotDelimitedYYYYMMDD" turns Feb. 2, 2007 into "2007.02.02." "ForwardSlashDelimitedMMDDYYYY" turns the same date into "2/2/2007." Now for the meat: Public Shared Function displayDate(ByVal intyear As Int32, ByVal intmonth As Int32, ByVal intday As Int32) As String Dim intCurrentFormat As Int32 = 0 Dim strDate As String = String.Empty Dim strMonth As String = String.Empty Dim strDay As String = String.Empty 'do some basic massaging 'check the year If intyear = 0 Then intyear = Now.Year 'check the month If intmonth = 0 Then intmonth = Now.Month 'check the day If intday = 0 Then intday = Now.Day 'set current date format 'check for a global value If Len(AppSettings("CommonDateFormat")) > 0 Then Try intCurrentFormat = Int32.Parse(AppSettings("CommonDateFormat")) Catch ex As Exception intCurrentFormat = 0 End Try End If If intCurrentFormat = 0 Then 'if no valid global value is found, set value locally intCurrentFormat = DateFormat.DotDelimitedYYYYMMDD End If Select Case intCurrentFormat Case DateFormat.DotDelimitedYYYYMMDD 'give single-digit values leading zeros strMonth = intmonth.ToString("0#") strDay = intday.ToString("0#") 'set our output strDate = intyear.ToString & "." & strMonth & "." & strDay Case DateFormat.ForwardSlashDelimitedMMDDYYYY 'set our output strDate = intmonth.ToString & "/" & intday.ToString & "/" & intyear.ToString Case Else End Select Return strDate End Function The function takes as input integer values for year, month and day and spits out the formatted string. We have two ways of setting the format value - either by an AppSettings entry in a Web.Config file or locally within the function. As you can see from the code above, I check Web. Config first, then resort to a local setting as a failsafe. The "dot- delimited" option also gives single-digit months and days leading zeros. There's certainly room for improvement here. I can, for example, check for a two-digit year entry and format it into YYYY. But I've also given myself the option of feeding in a zero, which will produce my four-digit year for me. Of course, the rub is, as the years change, the value will too - so using the "zero-option" is probably best for values you'll want to change dynamically, like a current date label or perhaps copyright information. The last part, of course, was going back through the site and converting all the dates again - but this time to the function call: displayDate(2007,2,2) Now a simple change in one location changes all of my dates to either the dot- or slash-delimited flavor. Spiffy. That should be it for now! Contact me using the site's contact form if you have questions. Feel free to use the code in your projects. A shout out in your project would be thoughtful. Also, drop me a line and let me know how you might have tweaked things to better suit your needs. Finally, I wouldn't profess to be THE expert on matters represented in my code -- so drop me a line if you have constructive suggestions, too. I'd like to hear from you! Best, halfgk copyright 2007 halfgk.com