Returns a formatted version of file 'LastModified' date.
Pass parameter Formatted as 0, to return date unformatted
as 1 to show date formatted as ' YYYY-MM-DD
2 ' MM-DD
3 ' H:M
11 ' YYYY-MMM-DD or MMM-DD
Function FileDate_Formatted(FullFilePath, orFileDate, Formatted)
' Needs FSO alredy defined
'
If FullFilePath > "" Then
set t = fso.getfile(Server.MapPath(FullFilePath))
siz = t.DateLastModified
orFileDate = siz
Else
siz = orFileDate
End If
If Formatted = 0 Then
FileDate_Formatted= siz
Exit Function
End If
Select Case Month(orFileDate)
Case 1: Moo2 = "Jan"
Case 2: Moo2 = "Feb"
Case 3: Moo2 = "Mar"
Case 4: Moo2 = "Apr"
Case 5: Moo2 = "May"
Case 6: Moo2 = "Jun"
Case 7: Moo2 = "Jul"
Case 8: Moo2 = "Aug"
Case 9: Moo2 = "Sep"
Case 10: Moo2 = "Oct"
Case 11: Moo2 = "Nov"
Case 12: Moo2 = "Dec"
End Select
If Formatted = 1 Then ' YYYY-MM-DD
t1 = Year(orFileDate) & "-" & Right("00" & Month(orFileDate),2) & "-" & Right("00" & Day(orFileDate),2)
ElseIf Formatted = 2 Then ' MM-DD
t1 = Right("00" & Month(orFileDate),2) & "-" & Right("00" & Day(orFileDate),2)
ElseIf Formatted = 3 Then ' H:M
t1 = Hour(orFileDate) & ":" & Minute(orFileDate)
ElseIf Formatted = 4 Then ' ???
ElseIf Formatted = 5 Then ' ???
ElseIf Formatted = 11 Then' YYYY-MMM-DD or MMM-DD
t1 = Year(orFileDate) & "-" & Moo2 & "-" & Right("00" & Day(orFileDate),2)
If Year(Date)=Year(orFileDate) Then
t1 = Moo2 & "-" & Right("00" & Day(orFileDate),2)
End If
Else
t1 = siz
End If
FileDate_Formatted = t1
End Function
' Needs FSO alredy defined
'
If FullFilePath > "" Then
set t = fso.getfile(Server.MapPath(FullFilePath))
siz = t.DateLastModified
orFileDate = siz
Else
siz = orFileDate
End If
If Formatted = 0 Then
FileDate_Formatted= siz
Exit Function
End If
Select Case Month(orFileDate)
Case 1: Moo2 = "Jan"
Case 2: Moo2 = "Feb"
Case 3: Moo2 = "Mar"
Case 4: Moo2 = "Apr"
Case 5: Moo2 = "May"
Case 6: Moo2 = "Jun"
Case 7: Moo2 = "Jul"
Case 8: Moo2 = "Aug"
Case 9: Moo2 = "Sep"
Case 10: Moo2 = "Oct"
Case 11: Moo2 = "Nov"
Case 12: Moo2 = "Dec"
End Select
If Formatted = 1 Then ' YYYY-MM-DD
t1 = Year(orFileDate) & "-" & Right("00" & Month(orFileDate),2) & "-" & Right("00" & Day(orFileDate),2)
ElseIf Formatted = 2 Then ' MM-DD
t1 = Right("00" & Month(orFileDate),2) & "-" & Right("00" & Day(orFileDate),2)
ElseIf Formatted = 3 Then ' H:M
t1 = Hour(orFileDate) & ":" & Minute(orFileDate)
ElseIf Formatted = 4 Then ' ???
ElseIf Formatted = 5 Then ' ???
ElseIf Formatted = 11 Then' YYYY-MMM-DD or MMM-DD
t1 = Year(orFileDate) & "-" & Moo2 & "-" & Right("00" & Day(orFileDate),2)
If Year(Date)=Year(orFileDate) Then
t1 = Moo2 & "-" & Right("00" & Day(orFileDate),2)
End If
Else
t1 = siz
End If
FileDate_Formatted = t1
End Function
FullFilePath, orFileDate, Formatted
Views 4,579
Downloads 1,391
CodeID
DB ID
ANmarAmdeen
613
Revisions
v2.0
Monday
April
29
2024