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 conversion issue - not converting the year properly

    Employee
    Posted 03-02-2016 03:51

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

    Originally posted by: gauravdb

    Hi Team,

    I know there are numerous posts on Date Conversion issue but I feel my issue has not been discussed in any thread before so posting it.

    I have some Data(in string) which I would like to convert to Date format. I am able to do the conversion using the date function but the problem is that some of the years are getting converted into 1900 and some are 2000.

    My String looks like this:

    DATE_MIS
    01-Feb-55
    01-Feb-55
    15-Jul-64
    15-Jul-64
    15-Nov-65
    15-Nov-65
    15-Sep-96
    15-Sep-96
    15-Sep-36

    After conversion, this is how it looks:

    test
    1955-02-01
    1955-02-01
    1964-07-15
    1964-07-15
    1965-11-15
    1965-11-15
    1996-09-15
    1996-09-15
    2036-09-15

    Can anyone please explain
    Thanks
    GK


  • 2.  RE: Date conversion issue - not converting the year properly

    Employee
    Posted 03-02-2016 04:20

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

    Originally posted by: Ivan

    Please provide the graph you using.


  • 3.  RE: Date conversion issue - not converting the year properly

    Employee
    Posted 03-02-2016 09:38

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

    Originally posted by: awilliams1024

    My understanding is that, in common with a number of other systems, the Lavastorm date function is implementing a cut-off when determining whether a two-digit year is interpreted as being in the current century or in the previous century.
    This cut off is set to 50. So, any two-digit year in the range 00 - 49 is interpreted as being in the current century (2000 - 2049) and any two-digit year in the range 50 - 99 is interpreted as being in the previous century (1950 - 1999).

    Best Regards,
    Adrian


  • 4.  RE: Date conversion issue - not converting the year properly

    Employee
    Posted 03-02-2016 09:45

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

    Originally posted by: awilliams1024

    If you wanted to provide your own explicit cut-off date you could use some script similar to the attached example (copy the code below into the BRE canvas).

    Best regards,
    Adrian

    node:Explicit_Date_CutOff_Year
    bretype:core::Filter
    editor:Label=Explicit Date Cut-Off Year
    editor:sortkey=56d6d9735cdd20ef
    input:@40fd2c74167f1ca2/=Dates.40fe6c55598828e5
    editor:bend=0=180|70
    editor:bend=0=180|190
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    if firstExec then MyCutOffYear = 50
    
    if isDate(DATE_MIS, "DD-m-YY") then {
    	Day_Mth = left(DATE_MIS, 6)
    	Yr = right(DATE_MIS, 2)
    	
    	if int(Yr) < MyCutOffYear then {
    		newDate = date(Day_Mth + "-" + "20" + Yr, "DD-m-CCYY")
    	}
    	else {
    		newDate = date(Day_Mth + "-" + "19" + Yr, "DD-m-CCYY")
    	}
    }
    else {
    	newDate = date(null)
    }
    
    emit *, newDate
    
    EOX
    editor:XY=260,190
    end:Explicit_Date_CutOff_Year
    
    node:Implicit_Date_CutOff_Year
    bretype:core::Filter
    editor:Label=Implicit Date Cut-Off Year
    editor:sortkey=56d714180d99780b
    input:@40fd2c74167f1ca2/=Dates.40fe6c55598828e5
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    
    if isDate(DATE_MIS, "DD-m-YY") then {
    	aDate = date(DATE_MIS, "DD-m-YY")
    }
    else {
    	aDate = date(null)
    }
    
    emit *, aDate
    
    EOX
    editor:XY=260,70
    end:Implicit_Date_CutOff_Year
    
    node:Dates
    bretype:core::Static Data
    editor:Label=Dates
    editor:sortkey=56d6d51b663e7d8a
    output:@40fe6c55598828e5/=
    prop:StaticData=<<EOX
    DATE_MIS
    01-Feb-55
    01-Feb-55
    15-Jul-64
    15-Jul-64
    15-Nov-65
    15-Nov-65
    15-Sep-96
    15-Sep-96
    15-Sep-36
    01-Feb-00
    01-Feb-02
    15-Jul-48
    15-Jul-49
    15-Nov-50
    15-Nov-51
    15-Sep-52
    15-Sep-53
    15-Sep-54
    15-Sep-99
    31-Dec-99
    
    EOX
    editor:XY=90,70
    end:Dates