GET LAST DAY OF A MONTH

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

code_language.skript:
function lastDay(m: number,y: number) :: number:
    if {_m} = 1,3,5,7,9,11:
        return 31
    else if {_m} = 2:
        if "%({_y}/4)%" contains ".":
            return 28
        else:
            return 29
    else:
        return 30

command /lastDay <number> <number>:
    usage: /lastDay [month] [year]
    trigger:
        send "&7The last day of month &a%arg-1% &7of the year &a%arg-2% &7is &a%lastDay(arg-1,arg-2)%"

command /lastDay2:
    trigger:
        send "&7The last day of this month is: &a%lastDay(month from date now parsed as a number,year from date now parsed as a number)%"

Requires SkUtilities: https://github.com/tim740/skUtilities/releases
[Works on 1.12 but is not supported]