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 minus 1 day

    Employee
    Posted 04-20-2014 01:03

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

    Originally posted by: sree

    Hi Team,
    in my source xlxs file, one of the column coming as "LOA START DATE", loading data into based on some condition
    'Last Day Work should be "LOA START DATE" minus 1 day',which funtion or logic need to apply to get date minus 1 day.


    Regards,
    Sree.


  • 2.  RE: Date minus 1 day

    Employee
    Posted 04-20-2014 19:53

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

    Originally posted by: stonysmith

    You can do this simply by:
    emit 'LOA START DATE'.dateAdjust(-1) as "Last Day Work"


  • 3.  RE: Date minus 1 day

    Employee
    Posted 04-20-2014 21:24

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

    Originally posted by: sree

    Thanks stonysmith for provided info.
    the code which is provided by you is not working properly.
    can you please provide any alternate for this task.


  • 4.  RE: Date minus 1 day

    Employee
    Posted 04-21-2014 14:08

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

    Originally posted by: ltolleson

    Can you please post the error you are getting.


    My guess is that the column 'LOA START DATE' is of type string instead of date. In that case you will need to use the date() function to convert the string into a date type before applying the dateAdjust(-1) function.

    Example...

    If the 'LOA START DATE' field contains a string that looks like "04/21/2014" then you would use the following code to convert and emit the output.

    LastDayWork = 'LOA START DATE'.date("MM/DD/CCYY").dateAdjust(-1)

    emit LastDayWork