United Kingdom Date Converter by David LohmannIn answer to the many forum posts I see regarding date formats, here is a code snippet which will display the date in UK format (dd/mm/yyyy) regardless of server location.
First it splits the date into an array, then checks whether the first array element represents the current month. If so it rearranges the string accordingly. If the server date just happens already to be in UK format, it simply reconstructs the original string. The date in the UK is 16/07/2003 Code that runs this demo <% 'Use this code freely. Just remember me when you're recruiting! 'Dave Lohmann dloh@uk2.net
Sub ShowUKdate()
dim dateStr, UKdate dateStr=split(date,"/")
'add leading zero to single figures
if Len(dateStr(0))<2 then dateStr(0)="0"&dateStr(0) end if
if Len(dateStr(1))<2 then dateStr(1)="0"&dateStr(1) end if
if Int(dateStr(0))=month(now) then UKdate=dateStr(1)&"/"&dateStr(0)&"/"&dateStr(2) else UKdate=join(dateStr,"/") end if
response.write UKdate End Sub %>
The date in the UK is <% ShowUKdate %>
|