Automic Workload Automation

Expand all | Collapse all

Get the "name" of the month

Jump to Best Answer
  • 1.  Get the "name" of the month

    Posted 11 days ago
    I was just looking at UC4 AE help documentation for SYS_DATE format. I was hoping for something like 2020-Oct-13.

    Is that even possible within UC4?

    Thanks in advance.

    Tim


  • 2.  RE: Get the "name" of the month

    Posted 11 days ago
    Hi Timothy,

    there is no direct support of this but it can be achieved by interpreting the numerical format as string and change the month number by it's character representation. You can use :IF/:ELSE/:ENDIF or :SWITCH/:CASE/:ENDSWITCH

    regards,
    Peter

    ------------------------------
    Capture Europe
    ------------------------------



  • 3.  RE: Get the "name" of the month
    Best Answer

    Posted 11 days ago
    Edited by Sandro Bucher 11 days ago
    Hi Tim

    Easier solution

    :define &ARR_DATE#, string, 3
    :fill &ARR_DATE#[] = str_split(&$PHYS_DATE_DD_MON_YYYY_d#,'-')
    :p "&ARR_DATE#[3]-&ARR_DATE#[2]-&ARR_DATE#[1]"

    Cheers

    Sandro

    ------------------------------
    Automation Engineer
    Swisscom
    ------------------------------



  • 4.  RE: Get the "name" of the month

    Posted 11 days ago

    :SET &TDAY_MM = SYS_LDATE("MM")
    :IF &TDAY_MM = 1
    :  SET &MTH_NAME# = "JANUARY"
    :  SET &MTH_ABRV# = "JAN"
    :  SET &MTH_ABRV_PCASE# = "Jan"
    :  SET &MTH_NAME_PCASE# = "January"
    :ENDIF
    :IF &TDAY_MM = 2
    :  SET &MTH_NAME# = "FEBRUARY"
    :  SET &MTH_ABRV# = "FEB"
    :  SET &MTH_ABRV_PCASE# = "Feb"
    :  SET &MTH_NAME_PCASE# = "February"
    :ENDIF
    :IF &TDAY_MM = 3
    :  SET &MTH_NAME# = "MARCH"
    :  SET &MTH_ABRV# = "MAR"
    :  SET &MTH_ABRV_PCASE# = "Mar"
    :  SET &MTH_NAME_PCASE# = "March"
    :ENDIF
    :IF &TDAY_MM = 4
    :  SET &MTH_NAME# = "APRIL"
    :  SET &MTH_ABRV# = "APR"
    :  SET &MTH_ABRV_PCASE# = "Apr"
    :  SET &MTH_NAME_PCASE# = "April"
    :ENDIF
    :IF &TDAY_MM = 5
    :  SET &MTH_NAME# = "MAY"
    :  SET &MTH_ABRV# = "MAY"
    :  SET &MTH_ABRV_PCASE# = "May"
    :  SET &MTH_NAME_PCASE# = "May"
    :ENDIF
    :IF &TDAY_MM = 6
    :  SET &MTH_NAME# = "JUNE"
    :  SET &MTH_ABRV# = "JUN"
    :  SET &MTH_ABRV_PCASE# = "Jun"
    :  SET &MTH_NAME_PCASE# = "June"
    :ENDIF
    :IF &TDAY_MM = 7
    :  SET &MTH_NAME# = "JULY"
    :  SET &MTH_ABRV# = "JUL"
    :  SET &MTH_ABRV_PCASE# = "Jul"
    :  SET &MTH_NAME_PCASE# = "July"
    :ENDIF
    :IF &TDAY_MM = 8
    :  SET &MTH_NAME# = "AUGUST"
    :  SET &MTH_ABRV# = "AUG"
    :  SET &MTH_ABRV_PCASE# = "Aug"
    :  SET &MTH_NAME_PCASE# = "August"
    :ENDIF
    :IF &TDAY_MM = 9
    :  SET &MTH_NAME# = "SEPTEMBER"
    :  SET &MTH_ABRV# = "SEP"
    :  SET &MTH_ABRV_PCASE# = "Sep"
    :  SET &MTH_NAME_PCASE# = "September"
    :ENDIF
    :IF &TDAY_MM = 10
    :  SET &MTH_NAME# = "OCTOBER"
    :  SET &MTH_ABRV# = "OCT"
    :  SET &MTH_ABRV_PCASE# = "Oct"
    :  SET &MTH_NAME_PCASE# = "October"
    :ENDIF
    :IF &TDAY_MM = 11
    :  SET &MTH_NAME# = "NOVEMBER"
    :  SET &MTH_ABRV# = "NOV"
    :  SET &MTH_ABRV_PCASE# = "Nov"
    :  SET &MTH_NAME_PCASE# = "November"
    :ENDIF
    :IF &TDAY_MM = 12
    :  SET &MTH_NAME# = "DECEMBER"
    :  SET &MTH_ABRV# = "DEC"
    :  SET &MTH_ABRV_PCASE# = "Dec"
    :  SET &MTH_NAME_PCASE# = "December"
    :ENDIF

    ------------------------------
    Sr. Data Coordinator
    Service Credit Union
    ------------------------------



  • 5.  RE: Get the "name" of the month

    Posted 10 days ago
    Edited by Pete Wirfs 10 days ago
    And another solution. 

    :set &MMOffset# = (&$PHYS_DATE_MM# * 3) - 2
    :set &MON# = substr("JanFebMarAprMayJunJulAugSepOctNovDec",&MMOffset#,3)
    :print "MON=&MON#"

    Easily modified to give longer results as well;
    :set &MMOffset# = (&$PHYS_DATE_MM# * 10) - 9
    :set &MONTH# = substr("January February March April May June July August September October November December ",&MMOffset#,10)
    :print "MONTH=&MONTH#"
    ------------------------------
    Pete Wirfs
    SAIF Corporation
    Salem Oregon USA
    ------------------------------



  • 6.  RE: Get the "name" of the month

    Posted 10 days ago

    I like some of the different ways I am seeing this done.  I need to look at changing up the way I am calculating some of these.​