LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  MonthName from Date

    Employee
    Posted 10-19-2017 08:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: martinh1976

    Hi - is it even possible to create a monthName from a date field?

    I have a date column:

    USAGE_CALL_DATE
    2017-03-27
    2017-03-27
    2016-02-01

    I would like to convert to the following but then also have the ability to SORT as I would with the actual date:

    MAR-2017
    MAR-2017
    FEB-2016

    I have managed to create a node which generates a value which is the same as the requested output but it is a string format so am unable to sort in a date order.

    thanks

    Martin


  • 2.  RE: MonthName from Date

    Employee
    Posted 10-19-2017 08:24

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    I would use this:

    m=USAGE_CALL_DATE.month()
    mmm="xxxJANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC".substr(m*3,3)      #note the xxx as month(0)
    emit mmm + "- " + USAGE_CALL_DATE.year().str() as Usage_Call_Month
    However, you're not going to be able to sort on that column. April would always come first.
    I would suggest keeping both columns in the data, sort on USAGE_CALL_DATE (the full date), and then remove that column just before output if you wish.


  • 3.  RE: MonthName from Date

    Employee
    Posted 10-30-2017 07:38

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: martinh1976

    Thanks Stony, i will go with inclusion of the full date to enable the sort. Thanks