Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Long Date Function
#1
Code: (Select All)
Function lDate$
    p$ = "th"
    If Val(Mid$(Date$, 4, 2)) <= 9 Then
        day$ = Right$(Mid$(Date$, 4, 2), 1)
    Else
        day$ = Mid$(Date$, 4, 2)
    End If
    If Val(Mid$(Date$, 4, 2)) = 1 Or Val(Mid$(Date$, 4, 2)) = 21 Or Val(Mid$(Date$, 4, 2)) = 31 Then p$ = "st"
    If Val(Mid$(Date$, 4, 2)) = 2 Or Val(Mid$(Date$, 4, 2)) = 22 Then p$ = "nd"
    If Val(Mid$(Date$, 4, 2)) = 3 Or Val(Mid$(Date$, 4, 2)) = 23 Then p$ = "rd"

    Select Case Val(Mid$(Date$, 1, 2))
        Case 1: Month$ = "January"
        Case 2: Month$ = "February"
        Case 3: Month$ = "March"
        Case 4: Month$ = "April"
        Case 5: Month$ = "May"
        Case 6: Month$ = "June"
        Case 7: Month$ = "July"
        Case 8: Month$ = "August"
        Case 9: Month$ = "September"
        Case 10: Month$ = "October"
        Case 11: Month$ = "November"
        Case 12: Month$ = "December"
    End Select
    lDate = day$ + p$ + " " + Month$ + " " + Mid$(Date$, 7, 4)
End Function
This code adds a function that will print a long date (21 February 2022) to the screen the instead of using date$ that would print 21-02-2022
Reply


Messages In This Thread
Long Date Function - by AtomicSlaughter - 05-21-2022, 09:20 PM
RE: Long Date Function - by Pete - 05-21-2022, 10:18 PM
RE: Long Date Function - by bplus - 05-24-2022, 08:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Function IsWord%(test$) bplus 5 244 02-26-2026, 02:51 PM
Last Post: mdijkens
  Sample program using the new _Files$ function eoredson 30 9,361 09-29-2025, 02:55 PM
Last Post: dakra137
  Another Dir/File compare function. eoredson 0 529 01-11-2025, 03:48 AM
Last Post: eoredson
  Button rack or hotkey function OldMoses 6 1,508 01-09-2025, 08:20 PM
Last Post: Jack002
  PrintW - print a long string, breaking it at the last space or hyphen before col. 79 TDarcos 21 4,121 04-22-2024, 09:52 PM
Last Post: Pete

Forum Jump:


Users browsing this thread: 1 Guest(s)