web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Compare date only field with date and time field

(0) ShareShare
ReportReport
Posted on by

I have a date only field that I am comapring with a date and time field (created on) and I am comparing them in the following way:

if Date only field = Date and time field with the intention that I only want to compare the day month and year part of both fields but the condition becomes false if the Date only field is populated 2 seconds after Date and time field is populated. 

So is there a way to compare Date only field with only the DD/MM/YYYY part of Date and time field ?

*This post is locked for comments

I have the same question (0)
  • ashlega Profile Picture
    34,477 on at

    Hi,

     if you have two dates, you can always use setHours on both of them, and, then, compare:

      var d1 = ..

      var d2 = ..

      d1.setHours(0,0,0,0);

      d2.setHours(0,0,0,0);

      if(d1 > d2){

      }

  • Community Member Profile Picture
    on at

    Thanks for the response. Actually I need to do this using out of the box workflow.

  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Well.. Maybe you need to create a calculated field, use DiffInDays function, and, in your workflow, check if the value is "0"

    You can still trigger that workflow on the update of the datetime field

    Or you can always develop a custom workflow activity to check the difference right in the workflow

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans