Jump to content
Sign in to follow this  
fromy

Compare Two Dates

Recommended Posts

Hi.

 

I have a table holding two fields with dates I try to compare in java script.

 

The first date is generated by caspio timestamp, and called "date_submitted", formatted like"05/15/2014 23:43:58" in the table.

The second date,"Date_event_start", is a date submitted from a Caspio calendar, formatted like "05/30/2014" in the table.

 

When i insert both dates in a HMTL block within Caspio they retur quite different.

 

"date_submitted" returns: "05/15/2014 11:43:58 PM"

and

"Date_event_start" returns:  "30.05.2014"

 

Why does Caspio default output different date formats???

 

 

I want to compare the dates with a simple script like:

 

<HTML>

[@field:Late_submitted]
<a id="visi[@field:ID_delegate]">
 
<script>
var isi = document.getElementById("visi[@field:ID_delegate]");
 
if('[@field:date_submitted]' >= '[@field:Date_event_start]'){
isi.parentNode.parentNode.style.backgroundColor = '#FFB0AD';
}
 
else{
isi.parentNode.parentNode.style.backgroundColor = '#ADD8E6';
}
 
</script>
</HTML>
 
 
 
How can i make the different date fields comparable???
 
 
--- Frode ---

Share this post


Link to post
Share on other sites

Hi Frode,

 

Is it a Result page of a Report DataPage?

 

On Configure Results Page Fields step, select your date.

In the Field options, there is the Formatting field.

I think, you can click the "Edit" button and select the same format for both dates.

 

On my DataPages i selected "Localization" for both fields and they work.

Share this post


Link to post
Share on other sites

Hi Jan.

 

Yes, it is a Result page of a report Datapage.

 

The formatting field solved it for me.

i had to include all date fields in the result page to make sure they where equally custom formatted.

To bad there is on option to hide fields you don`t want, but still need to format.

 

Thank you.

 

 

--- Frode ---

Share this post


Link to post
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
Reply to this topic...

×   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...
Sign in to follow this  

×
×
  • Create New...