Forum Discussion

kumar25's avatar
kumar25
New Contributor II
2 years ago

Difference between 2 dates, excluding weekends

I have 2 date values, have to find the difference between both of them. Weekends to be excluded.

I am using the below expression to derive the value.

parseInt((Date.parse($Date2.toString())-Date.parse($Date1.toString()))/(1000*60*60*24)*0.71)

This logic is failing when

1. Date1 and Date2 are in the same week(for example 15/01/2024 and 19/01/2024)

2. Date 1 and Date2 are in different weeks but the difference is less than 7 days(19/01/2024 and 24/01/2024)

2 Replies

  • jpanikulam's avatar
    jpanikulam
    New Contributor II

    A related question to this that we’ve been working on is - How to use Service Accounts that pipelines can be run under in Prod? We don’t want production tasks to be run under any particular user’s credentials but rather under a Service Account instead.
    Please let me know your thoughts on SnapLogic best practices around this.

  • dmiller's avatar
    dmiller
    Former Employee

    There is currently no public API for changing the owner of an asset. You can file an enhancement request through Support if this is something you feel you need.

    • kmiesse's avatar
      kmiesse
      Contributor

      Thank you.

      1. Can you tell me what changing the owner of a project changes if it doesn’t change the Username in Dashboard?
      2. When using the SnapLogic Metadata snaps to create assets will the owner always be the owner of the asset being copied and will changing the owner on the input document not be effective?
      3. Also, can you tell me where the Username on an execution in Dashboard comes from? Maybe I can back into with that information.
      • akidave's avatar
        akidave
        Employee
        1. Project ownership controls who can grant access to the project. Assets within the project are owned by whoever created them, which can be anyone having write access to the project.
        2. Assets created with Metadata snap are created under the ownership of the user who ran the pipeline.
        3. Dashboard shows the user account under which the pipeline ran. Scheduled and triggered task executions show as the user who created the task.
  • For triggered tasks, the username field will show the user who created the task, the pipeline actually runs as the task owner. A change to show the task invoker username was done a few releases back. It is displayed as a new property called Remote User in the pipeline runtime info dialog, under the Extra Details tab. If the task was invoked with basic auth, this property will show the invoker username. If the task was invoked with some other authentication, like bearer token, this property will not show up, since we do not have the invoker details in that case.