You are viewing limited content. For full access, please sign in.

Question

Question

Calculate Minutes Between Two Date/Time Values

asked on December 22, 2016 Show version history

Hello, 

I have a Laserfiche Form where I am gathering a Date and Time value (within the form) and I want to contrast those values against when the form is actually submitted. I want to calculate the minutes between the values on the form and when the form was submitted. 

Is this possible with workflow and the date token calculator or token calculator? 

0 0

Replies

replied on December 22, 2016

Hi Justin,

You should be able to calculate the time differential between two tokens in minutes by selecting the custom time option and selecting minutes.

Hope this helps!
 

replied on December 22, 2016

The attached image shows a script that was posted in a different question.  Does this help?

Minutes.tif (11.95 KB)
0 0
replied on December 22, 2016 Show version history

Justin,

I just accomplished this using a stored procedure and the Custom Query activity in Workflow.  Please see the steps and screenshots below:

 

Custom Query with ODBC data source selected:

 

Custom Query snippet:

DECLARE @RC int
DECLARE @startDate datetime = ?
DECLARE @endDate datetime = ?

EXECUTE @RC = [FormsExternal].[dbo].[DateDiffbyMinute] 
   @startDate
  ,@endDate

SQL Query to showing elements of the stored procedure:

USE [FormsExternal]
GO
/****** Object:  StoredProcedure [dbo].[DateDiffbyMinute]    Script Date: 12/22/2016 15:37:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[DateDiffbyMinute]
	-- Add the parameters for the stored procedure here
	@startDate datetime,
	@endDate datetime
AS
BEGIN

	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	SELECT DATEDIFF (mi, @startDate, @endDate)
END

Here's the return value from the Custom Query Activity:

My dates were '2016-12-21 15:09:00' and '2016-12-22 15:09:00' - exactly 1 day, which is equivalent to 1440 minutes.

0 0
replied on December 23, 2016 Show version history

One other option is to use the Qfiche Toolkit Date Difference custom workflow activity.  The activity is available on the Products page of the Qfiche website at www.qfiche.com/Products.  The activity will allow you to create any number of tokens that accept two date/time values and will return the difference between them in any of the following intervals; Seconds, Minutes, Hours, Days, Business Days, Weeks, Calendar Weeks, Months, Quarters, Years.

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.