ANmaDate

Returns date in human format.
Which is as follows...
Just day name (and time) if date is within past 7 days.
Returns Month and day, like Mar15, if within past 365 days
Otherwise will return the full date, 2022Feb8
This is the VBScript version of Jan8 date format
Used in this website as of April 26th 2023

CodeFunctionName
What is this?

Public

Tested

Original Work
Function ANmaDate(WithDate)
    WDate                        = CDate(WithDate)
    Rett                        = WDate
    If IsDate(WDate) Then
        ' =IF(AND(E34 <TODAY(), TODAY()-E34 <7), TEXT(E34,"DDD"), IF( AND(E34 <TODAY(), TODAY()-E34 <365), TEXT(E34, "mmmd"),TEXT(E34,"yyyymmmd")))
        If WDate <= NOW Then    ' Past
            If Now - WDate < 7 Then
                Rett            = VB6Format(WDate, "ddd HAP")
            ElseIf Now - WDate < 365 Then
                Rett            = VB6Format(WDate, "mmmd")
            Else
                Rett            = VB6Format(WDate, "yyyymmmd")
            End If
        Else            ' Future
           
        End If
    End If
    ANmaDate                    = Rett
End Function

WithDate

Views 79

Downloads 24

CodeID
DB ID

ANmarAmdeen
593
Attachments
Revisions

v1.0

Thursday
April
27
2023