Salesforce

DifDateTime (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

DifDateTime (Magic xpa 3.x)

Calculates the difference between two Datetime values.

The second Datetime value is subtracted from the first Datetime value. The result is represented by the number of whole days between the two Datetime values and the number of seconds of the remaining part of the day.

Syntax:

DifDateTime (Date1, Time1, Date2, Time2, DaysVariable, SecondsVariable)

Parameters:

Date1 &Time1 – This parameter represents the first Datetime value.

Date2 & Time2 – This parameter represents the second Datetime value.

DaysVariable – This is a reference to a Numeric variable. This function updates this variable with the difference in whole days between the first Datetime value to the second one. The DaysVariable is updated with the day part.

SecondsVariable – This is a reference to a Time variable. This function updates this variable with the difference in whole seconds between the first Datetime value. The DestDays parameter value represents the second Datatime value. The SecondsVariable is updated with the remaining seconds time.

Returns:

Returns the number of days and number of seconds that are the difference between the two date-time pairs.

Example:

The difference between November 25, 2004 at 10:00 AM and November 24, 2004 at 11:10 AM is 1 day and 4200 seconds.

Note:

You can convert the number of seconds into hours/minutes/seconds by treating it as a Time variable and using the Hour, Minute, and Second functions on it.

The variables for the last two parameters are entered as variable references. That is, they are written in quotes, followed by the VAR literal: 'E'VAR and 'F'VAR. This is the format Magic xpa uses to refer to a variable by address. This is necessary to update the variable from within an expression. Usually Magic xpa only updates variables with an Update operation, but in this case you are updating two variables at the same time, so a reference is needed.

See also:

AddDateTime, AddDate, AddTime

How Do I Calculate the Difference Between Two Datetime Values?

The Online and Rich Client Samples projects (program DT07 and RDT07)

Reference
Attachment 
Attachment