Jump to content
  • 0

Subtract two dates and convert the result into days


perland
 Share

Question

Hello,

I have a search and report DataPage that I would like to show the difference between two dates in days. The start day will be new Date(), and the end date a time field in a table. Below is an outline of the code. Is there an easy way to do this?

Thank You.

var StartDate = new Date();

var EndDate = document.getElementById("InsertRecordpatient_status_change_timestamp").value;

Var NumberDays = StartDate-EndDate

document.write(NumberDays);

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hello,

If you are using a Search and Report Datapage, and if you have two date fields in the table associated with the Datapage, then you can use Calculated Fields to calculate the date difference. Please see this link to setup calculated fields in your Datapage:

http://howto.caspio.com/datapages/creat ... ed-fields/

The date difference function is :

Datediff(day,[@field:Date1],[@field:Date2])

Take a look at this link for more information on the Datediff function:
http://msdn.microsoft.com/en-us/library/ms189794.aspx

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...