#monthnumber()

DESCRIPTION
    returns the current month (1-12)

    or:

    returns the month as a digit (1-12) for the given string representing a month
    ("January", "February", ...; "Jan", "Feb", ...)
SYNOPSIS
    #monthnumber()

    or:

    #monthnumber(s)
ARGUMENTS
    none

    or:

    s - a string, or string expression, representing a month
        ("January", "February", ...; "Jan", "Feb", ...)
EXAMPLES
# pikt +C 'output $text(#monthnumber())'
6

# pikt +C 'output $text(#monthnumber("February"))'
2

# pikt +C 'output $text(#monthnumber("Nov"))'
11
        rule    // if it's been more than #hrs hours since the last piktd_log
                // entry, piktd is not logging, hence appears to be hung/dead;
                do #split($time, ":")
                set #t = #datevalue(#yrnow - #if(#monnow == 1 && $mon eq "Dec", 1, 0),
                                    #monthnumber($mon), #date)
                         + #timevalue(#val($[1]), #val($[2]), #val($[3]))
                if #timenow - #t > #hrs*60*60
                        output mail "piktd appears to be hung/dead on $sys"
                endif
        rule    // since the "last" command output doesn't show the year,
                // we need a way to determine if we are wrapping around
                // to previous years; keeping track of month turnovers is
                // a kludgy way to do this
                set #monthnumber_reboot = #monthnumber($mon)
                if #monthnumber_reboot != @monthnumber_reboot
                        =incr(#monthturnovers)
                endif
SEE ALSO
    #month()
    #day()
    #daynumber()
    #weekday()
    #year()
    #yearday()
    #yearweek()
    $dayname()
    $monthname()

    Numerical Functions
    String Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View the list of
Related Projects
and Products