/ Published in: ASP
                    
                                        
Todays dates are shown as hh:mm, dates from yesterday and earlier as dd mmm.
This can be useful, since recent dates are showing more details
                This can be useful, since recent dates are showing more details
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<%
function FormDate(datum)
if datum & "" = "" then FormDate="onbekend" : exit function
if datum = "1-1-1900" then FormDate="-nooit-" : exit function
hulp=split(replace(datum,"/","-") & ""," ")
if UBound(hulp)<1 then FormDate=datum & " !" : exit function
tijd=split(hulp(1),":")
if UBound(tijd)<2 then FormDate=datum & " !" : exit function
dag=split(hulp(0),"-")
if UBound(dag)<2 then FormDate=datum & " !" : exit function
if instr(datum,"/")>0 then hulp=dag(1) : dag(1)=dag(0) : dag(0)=hulp
if len(dag(1))=1 then dag(1)="0" & dag(1)
dag(1)=mid("XXJanFebMrtAprMeiJunJulAugSepOktNovDec",dag(1)*3,3)
if len(tijd(0))=1 then tijd(0)="0" & tijd(0)
if len(tijd(1))=1 then tijd(1)="0" & tijd(1)
if len(dag(0))=1 then dag(0)="0" & dag(0)
if datum>=date() then
FormDate=tijd(0) & ":" & tijd(1) & "u"
else
if year(datum)=year(date()) then
FormDate=dag(0) & "-" & dag(1) & " " ' & tijd(0) & ":" & tijd(1) & "u"
else
FormDate=dag(0) & "-" & dag(1) & "-" & dag(2) & " " ' & tijd(0) & ":" & tijd(1) & "u"
end if
end if
end function
%>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                