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.  Date Format Control

    Employee
    Posted 06-24-2016 06:45

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

    Originally posted by: jpstory

    Hi

    Is there any way to control the format of dates ?

    for example the input was string as "12/02/2016" how can I reformat it into the following forms but still maintain the data type of Date:

    1. 12/02/16

    2. Dec.12.2016

    Thanks


  • 2.  RE: Date Format Control

    Employee
    Posted 06-24-2016 12:35

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

    Originally posted by: ltolleson

    Hi,

    There is not a way to do what you are asking. In Lavastorm the date type is stored as binary data and is displayed as "YYYY-MM-DD". If you want to report the date value in a different format you will need to convert it to a string in the appropriate format before outputting the results.

    Example (can be used in a filter node)

    internalDate = date(2016,12,12)
    
    reportMonth = internalDate.month()
    reportDay = internalDate.day()
    reportYear = internalDate.year()
    
    strMonth = reportMonth.switch(1,"Jan",
                                     2,"Feb",
                                     3,"Mar",
                                     4,"Apr",
                                     5,"May",
                                     6,"Jun",
                                     7,"Jul",
                                     8,"Aug",
                                     9,"Sep",
                                     10,"Oct",
                                     11,"Nov",
                                     12,"Dec",
                                      "Not Found")
    
    # Alternate way to calculate strMonth - Thanks Stony Smith
    #strMonth=substr("xxxJanFebMarAprMayJunJulAugSepOctNovDec",reportMonth*3,3)
    
    strDate = strMonth + "." + reportDay + "." + reportYear
    
    emit *
    emit internalDate
    emit strDate
    Thanks,
    Larry