Jump to content

Search the Community

Showing results for tags 'Business Day Only'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Caspio Bridge
    • General Questions
    • Caspio JavaScript Solutions
    • Tables, Views and Relationships
    • Import/Export and DataHub
    • DataPages
    • Deployment
    • Security, Authentications, Roles, SAML
    • Styles and Localizations
    • Parameters
    • API and Integration
    • Calculations and aggregations
    • User JavaScript and CSS Discussions

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. In a table that I have, I have a date field that indicates the date an order was placed. I would like to create a calculated field in my datapage that will indicate how long it has been since the order was open (that is, the difference between today's date and the order creation date). Is there any way to do this? I know it will involve Datediff but I am unsure of how to insert today's date automatically. Ex. Order Created - 1/20/16 Today's Date - 2/12/16 The expected output would be 23. Thank you. EDIT: So I've implemented this using the following formula: DATEDIFF(day,OrderDate, GETUTCDATE()) and it works correctly but now I need this to ONLY count business days (at the moment, it is counting weekends as well). EDIT 2: I've figured it out. I will leave the answer here for posterity: To calculate the difference in dates (only considering business days), enter the following into your calculated field: select (DATEDIFF(dd,@StartDate, @EndDate)) - (DATEDIFF(ww,@StartDate, DATEADD(dd,-1,@EndDate)) * 2) - (CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 else 0 end) - (CASE WHEN DATENAME(dw, @EndDate) = 'Sunday' THEN 1 else 0 end) where you replace @StartDate and @EndDate with your corresponding fields (if you're calculating days from today, then use GETUTCDATE() for @EndDate).
×