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 to string format

    Employee
    Posted 05-07-2012 21:17

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

    Originally posted by: mwillett

    Hi there,

    I have data with dates structured as follows "01 January, 2011". The day part is always the first two characters and the year part is always the last four. I can convert these to a date format with the node below but is there a better way (to handle a full named month including the trailing comma)?

    Regards,
    Mike


    node:Filter
    bretype:core::Filter
    editor:sortkey=4fa8999b2cbc352d
    input:@40fd2c74167f1ca2/=Donor_Events.41e6c6cd11e613c6
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    CalendarDay = left(CAL_DATE, 2)
    CalendarMonth = regexSubstituteI(CAL_DATE, "[^A-Za-z]", "")
    CalendarYear = right(CAL_DATE, 4)

    if CalendarMonth == "January" then CalMonth = "01"
    else if CalendarMonth == "February" then CalMonth = "02"
    else if CalendarMonth == "March" then CalMonth = "03"
    else if CalendarMonth == "April" then CalMonth = "04"
    else if CalendarMonth == "May" then CalMonth = "05"
    else if CalendarMonth == "June" then CalMonth = "06"
    else if CalendarMonth == "July" then CalMonth = "07"
    else if CalendarMonth == "August" then CalMonth = "08"
    else if CalendarMonth == "September" then CalMonth = "09"
    else if CalendarMonth == "October" then CalMonth = "10"
    else if CalendarMonth == "November" then CalMonth = "11"
    else if CalendarMonth == "December" then CalMonth = "12"

    NewCalDate = date(strcat(CalendarDay, CalMonth, CalendarYear), "DDMMCCYY")

    emit CAL_DATE, CalendarDay, CalendarMonth, CalMonth, CalendarYear, NewCalDate

    EOX
    editor:XY=390,240
    end:Filter


  • 2.  RE: Date to string format

    Employee
    Posted 05-07-2012 21:29

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

    Originally posted by: stonysmith

    I would just use this:

    node:Filter
    bretype:core::Filter
    editor:sortkey=4fa8999b2cbc352d
    input:@40fd2c74167f1ca2/=Static_Data.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    t = split(Cal_Date," ")
    DateStr = t[0] + left(t[1],3) + t[2]
    NewCalDate = date(DateStr , "DDmCCYY")

    emit CAL_DATE,DateStr,NewCalDate
    EOX
    editor:XY=270,180
    end:Filter


  • 3.  RE: Date to string format

    Employee
    Posted 05-09-2012 06:43

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

    Originally posted by: mwillett

    Thanks Stony,

    That makes sense. I gather then that the full month format is not standard at present.

    Mike