{"id":2795,"date":"2020-03-30T15:37:03","date_gmt":"2020-03-30T15:37:03","guid":{"rendered":"https:\/\/www.leadshook.com\/help\/?p=2795"},"modified":"2024-02-14T11:51:23","modified_gmt":"2024-02-14T11:51:23","slug":"dates-and-time-custom-fields-in-your-decision-trees","status":"publish","type":"post","link":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/","title":{"rendered":"How to use Dates and Time Custom Fields in Your Decision Trees"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, you&#8217;ll learn about the various ways you can save dates, times and perform calculations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Please note:  Be sure to use the CORRECT type of field.  You should use date, time or date&amp;time custom fields.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add scripts on node&#8230; <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"697\" src=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg\" alt=\"\" class=\"wp-image-2851\" srcset=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg 1024w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-300x204.jpg 300w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-768x523.jpg 768w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-60x41.jpg 60w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-150x102.jpg 150w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node.jpg 1227w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-black-color has-luminous-vivid-amber-background-color has-text-color has-background wp-block-paragraph\"><strong>Important:<\/strong> DT.setField function cannot be used on the last node for V2 DTs. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1) <strong>Save Today&#8217;s Date Into a Field<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Add this script on the node&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.min.js\" integrity=\"sha512-CryKbMe7sjSCDPl18jtJI5DR5jtkUWxPXWaLCst6QjH8wxDexfRJic2WRmRXmstr2Y8SxDDWuBO6CQC6IE4KTA==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n  DT.setField('test_date_1', moment.utc().startOf('day').valueOf());\n&lt;\/script&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2) <strong>Save Today&#8217;s Date Less 6 Months Into a Field<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Add this script on the node&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.min.js\" integrity=\"sha512-CryKbMe7sjSCDPl18jtJI5DR5jtkUWxPXWaLCst6QjH8wxDexfRJic2WRmRXmstr2Y8SxDDWuBO6CQC6IE4KTA==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n  DT.setField('test_date_1', moment.utc().startOf('day').subtract(6, 'months').valueOf())\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3) <strong>Days between two dates<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create a custom field called &#8220;daysOld&#8221; ( number field, visible: yes )<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Create a custom field called &#8220;DOB&#8221; <\/p>\n\n\n\n<p class=\"has-luminous-vivid-amber-background-color has-background wp-block-paragraph\"><strong>Note:<\/strong> The Format is important. It should be MM\/DD\/YYYY and of input type: combobox.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10.png\" data-rel=\"lightbox-gallery-IqIsJYC8\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" width=\"1024\" height=\"562\" src=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-1024x562.png\" alt=\"\" class=\"wp-image-2796\" srcset=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-1024x562.png 1024w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-300x165.png 300w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-768x421.png 768w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-1536x842.png 1536w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-60x33.png 60w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10-150x82.png 150w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/03\/image-10.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. Copy\/paste this code into any script sections of a node that captures a date in the past. For example a question that asks &#8220;What is your date of birth?&#8221;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.min.js\" integrity=\"sha512-CryKbMe7sjSCDPl18jtJI5DR5jtkUWxPXWaLCst6QjH8wxDexfRJic2WRmRXmstr2Y8SxDDWuBO6CQC6IE4KTA==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n\/\/Get our 2 dates\ntoday = new Date()\npast = new Date('{DOB}')\n\nconsole.log('DOB: '+past);\n\n\/\/Calculate the time difference of two dates\nvar diff = today.getTime() - past.getTime();\nvar days = Math.floor(diff \/ (1000 * 3600 * 24));\n \n\/\/Print result on browser console\nconsole.log(\"Number of days old: \"+days);\n \n\/\/Assign result to custom field\nDT.setField('daysOld', days);\n\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Publish and access via direct link. Check the browser console for the number of days to print.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Decision Node: You can also use decision nodes to compare 2 dates&#8230;<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"219\" src=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes-1024x219.jpg\" alt=\"\" class=\"wp-image-2853\" srcset=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes-1024x219.jpg 1024w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes-300x64.jpg 300w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes-768x164.jpg 768w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes-60x13.jpg 60w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes-150x32.jpg 150w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Decision-Nodes.jpg 1362w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">4) <strong>Time between two dates in days, months, and years<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>You will need to create the DOB custom field as described previously<\/li>\n\n\n\n<li>Create three number custom fields called &#8220;days&#8221;, &#8220;months&#8221;, &#8220;years&#8221;<\/li>\n\n\n\n<li>Copy\/paste this code into any script sections of a node that captures a date in the past. For example a question that asks &#8220;What is your date of birth?&#8221;.<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.min.js\" integrity=\"sha512-CryKbMe7sjSCDPl18jtJI5DR5jtkUWxPXWaLCst6QjH8wxDexfRJic2WRmRXmstr2Y8SxDDWuBO6CQC6IE4KTA==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n\/\/Get our 2 dates\ntoday = new Date()\npast = new Date('{DOB}')\n \nconsole.log('DOB: '+past);\n\ndy = today.getYear()  - past.getYear();\ndm = today.getMonth() - past.getMonth();\ndd = today.getDate()  - past.getDate();\n\nif (dd &lt; 0) { dm -= 1; dd += 30; }\nif (dm &lt; 0) { dy -= 1; dm += 12; }\n\nconsole.log(dy+\" Year(s), \"+dm+\" Month(s), and \"+dd+\" Days.\");\n\n  \/\/Assign result to custom field\nDT.setField('days', dd);\nDT.setField('months', dm);\nDT.setField('years', dy);\n\n&lt;\/script&gt;\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">5) Get age from a given date of birth<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>You will need to create a custom field called {birth_date}<\/li>\n\n\n\n<li>You will need to create a custom field called {age}<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Where you capture the birth_date, you will need to fire this script on exit of the node:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.min.js\" integrity=\"sha512-CryKbMe7sjSCDPl18jtJI5DR5jtkUWxPXWaLCst6QjH8wxDexfRJic2WRmRXmstr2Y8SxDDWuBO6CQC6IE4KTA==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n  var today = new Date();\n    var birthDate = new Date('{birth_date}');\n    var age = today.getFullYear() - birthDate.getFullYear();\n    var m = today.getMonth() - birthDate.getMonth();\n    if (m &lt; 0 || (m === 0 &amp;&amp; today.getDate() &lt; birthDate.getDate())) {\n        age--;\n    }\n    console.log(age);\n  DT.setField('age', age);\n  \n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then you can access the correct age using the {age} custom field in your Decision Tree.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6) Assign MM-DD-YY to their own individual custom fields.<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create 3 custom fields which will be used to store the value of MM, DD, and YY<\/li>\n\n\n\n<li>Create a decision node to set the value of those 3 fields.<\/li>\n\n\n\n<li>Apply <a href=\"https:\/\/www.leadshook.com\/help\/using-cases-and-field-filters-to-convert-a-custom-field-to-another-format-and-display-it-within-the-node-level-settings\/\" target=\"_blank\" rel=\"noreferrer noopener\">Field Filters<\/a> to get individual values of MM, DD, and YY<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Example of how it would look like inside the decision node.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>day_customfield &gt; {yourdate|date:'DD'}\nmonth_customfield &gt; {yourdate|date:'MM'}\nyear_customfield &gt; {yourdate|date:'YYYY'}<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2022\/06\/Capture.png\" alt=\"\" class=\"wp-image-4954\" style=\"width:547px;height:595px\" width=\"547\" height=\"595\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">7.) Adding and Subtracting Years, Months or Days from today&#8217;s date.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">1. Create a DATE type custom field first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. Use one of the scripts below.<br><br>A.) test_date_1 will subtract 308 weeks from today.<br><br>B.) test_date_2 will subtract 6 years from today.<br><br>C.) test_date_3 will add 14 days from today.<br><br>You will need to edit the script and only use one of them depending on what you want to add or subtract.<br><br><br>DT.setField(&#8216;<strong>YOUR_FIELD_HERE<\/strong>&#8216;, moment.utc().startOf(&#8216;day&#8217;).<strong>ADD\/SUBTRACT<\/strong>(<strong>NUMBERVALUE<\/strong>, &#8216;<strong>WEEKS\/DAYS\/YEARS<\/strong>&#8216;).valueOf())<br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/moment.js\/2.29.4\/moment.min.js\" integrity=\"sha512-CryKbMe7sjSCDPl18jtJI5DR5jtkUWxPXWaLCst6QjH8wxDexfRJic2WRmRXmstr2Y8SxDDWuBO6CQC6IE4KTA==\" crossorigin=\"anonymous\" referrerpolicy=\"no-referrer\"&gt;&lt;\/script&gt;\n\n&lt;script&gt;\n  DT.setField('test_date_1', moment.utc().startOf('day').subtract(308, 'weeks').valueOf())\n  DT.setField('test_date_2', moment.utc().startOf('day').subtract(6, 'years').valueOf())\n  DT.setField('test_date_3', moment.utc().startOf('day').add(14, 'day').valueOf())\n\n&lt;\/script&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In this article, you&#8217;ll learn about the various ways you can save dates, times and perform calculations. Please note: Be sure to use the CORRECT type of field. You should use date, time or date&amp;time custom fields. Add scripts on node&#8230; Important: DT.setField function cannot be used on the last node for V2 DTs. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[620],"tags":[235,629,345,365,628,627,300,161,567,355],"class_list":["post-2795","post","type-post","status-publish","format-standard","hentry","category-scripts","tag-between","tag-birth","tag-calculate","tag-date","tag-date-of-birth","tag-days","tag-decision-nodes","tag-decision-tree","tag-script","tag-time"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to use Dates and Time Custom Fields in Your Decision Trees - LeadsHook Knowledge Base<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to use Dates and Time Custom Fields in Your Decision Trees - LeadsHook Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"Introduction: In this article, you&#8217;ll learn about the various ways you can save dates, times and perform calculations. Please note: Be sure to use the CORRECT type of field. You should use date, time or date&amp;time custom fields. Add scripts on node&#8230; Important: DT.setField function cannot be used on the last node for V2 DTs. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/\" \/>\n<meta property=\"og:site_name\" content=\"LeadsHook Knowledge Base\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/leadshook\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-30T15:37:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-14T11:51:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg\" \/>\n<meta name=\"author\" content=\"Nik T\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@leadshook\" \/>\n<meta name=\"twitter:site\" content=\"@leadshook\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nik T\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/\"},\"author\":{\"name\":\"Nik T\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#\\\/schema\\\/person\\\/4bfe37d814563cc729828b7055313f4d\"},\"headline\":\"How to use Dates and Time Custom Fields in Your Decision Trees\",\"datePublished\":\"2020-03-30T15:37:03+00:00\",\"dateModified\":\"2024-02-14T11:51:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/\"},\"wordCount\":460,\"publisher\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Add-script-on-node-1024x697.jpg\",\"keywords\":[\"between\",\"birth\",\"calculate\",\"date\",\"date of birth\",\"days\",\"decision nodes\",\"decision tree\",\"script\",\"time\"],\"articleSection\":[\"Scripts\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/\",\"name\":\"How to use Dates and Time Custom Fields in Your Decision Trees - LeadsHook Knowledge Base\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Add-script-on-node-1024x697.jpg\",\"datePublished\":\"2020-03-30T15:37:03+00:00\",\"dateModified\":\"2024-02-14T11:51:23+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Add-script-on-node-1024x697.jpg\",\"contentUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Add-script-on-node-1024x697.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/dates-and-time-custom-fields-in-your-decision-trees\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use Dates and Time Custom Fields in Your Decision Trees\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#website\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/\",\"name\":\"LeadsHook Knowledge Base\",\"description\":\"LeadsHook Training &amp; Technical Help\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#organization\",\"name\":\"LeadsHook\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/leadshook-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/leadshook-logo.png\",\"width\":350,\"height\":83,\"caption\":\"LeadsHook\"},\"image\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/leadshook\\\/\",\"https:\\\/\\\/x.com\\\/leadshook\",\"https:\\\/\\\/www.linkedin.com\\\/showcase\\\/leadshook\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#\\\/schema\\\/person\\\/4bfe37d814563cc729828b7055313f4d\",\"name\":\"Nik T\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/48d53e68db0b1db1cd5c54a750130fb2ee0c663306ff1bd434373f1a368ef7a0?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/48d53e68db0b1db1cd5c54a750130fb2ee0c663306ff1bd434373f1a368ef7a0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/48d53e68db0b1db1cd5c54a750130fb2ee0c663306ff1bd434373f1a368ef7a0?s=96&d=mm&r=g\",\"caption\":\"Nik T\"},\"sameAs\":[\"http:\\\/\\\/www.LeadsHook.com\"],\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/author\\\/nik\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to use Dates and Time Custom Fields in Your Decision Trees - LeadsHook Knowledge Base","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/","og_locale":"en_US","og_type":"article","og_title":"How to use Dates and Time Custom Fields in Your Decision Trees - LeadsHook Knowledge Base","og_description":"Introduction: In this article, you&#8217;ll learn about the various ways you can save dates, times and perform calculations. Please note: Be sure to use the CORRECT type of field. You should use date, time or date&amp;time custom fields. Add scripts on node&#8230; Important: DT.setField function cannot be used on the last node for V2 DTs. [&hellip;]","og_url":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/","og_site_name":"LeadsHook Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/leadshook\/","article_published_time":"2020-03-30T15:37:03+00:00","article_modified_time":"2024-02-14T11:51:23+00:00","og_image":[{"url":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg","type":"","width":"","height":""}],"author":"Nik T","twitter_card":"summary_large_image","twitter_creator":"@leadshook","twitter_site":"@leadshook","twitter_misc":{"Written by":"Nik T","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#article","isPartOf":{"@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/"},"author":{"name":"Nik T","@id":"https:\/\/www.leadshook.com\/help\/#\/schema\/person\/4bfe37d814563cc729828b7055313f4d"},"headline":"How to use Dates and Time Custom Fields in Your Decision Trees","datePublished":"2020-03-30T15:37:03+00:00","dateModified":"2024-02-14T11:51:23+00:00","mainEntityOfPage":{"@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/"},"wordCount":460,"publisher":{"@id":"https:\/\/www.leadshook.com\/help\/#organization"},"image":{"@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#primaryimage"},"thumbnailUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg","keywords":["between","birth","calculate","date","date of birth","days","decision nodes","decision tree","script","time"],"articleSection":["Scripts"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/","url":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/","name":"How to use Dates and Time Custom Fields in Your Decision Trees - LeadsHook Knowledge Base","isPartOf":{"@id":"https:\/\/www.leadshook.com\/help\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#primaryimage"},"image":{"@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#primaryimage"},"thumbnailUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg","datePublished":"2020-03-30T15:37:03+00:00","dateModified":"2024-02-14T11:51:23+00:00","breadcrumb":{"@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#primaryimage","url":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg","contentUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/04\/Add-script-on-node-1024x697.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.leadshook.com\/help\/dates-and-time-custom-fields-in-your-decision-trees\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.leadshook.com\/help\/"},{"@type":"ListItem","position":2,"name":"How to use Dates and Time Custom Fields in Your Decision Trees"}]},{"@type":"WebSite","@id":"https:\/\/www.leadshook.com\/help\/#website","url":"https:\/\/www.leadshook.com\/help\/","name":"LeadsHook Knowledge Base","description":"LeadsHook Training &amp; Technical Help","publisher":{"@id":"https:\/\/www.leadshook.com\/help\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.leadshook.com\/help\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.leadshook.com\/help\/#organization","name":"LeadsHook","url":"https:\/\/www.leadshook.com\/help\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.leadshook.com\/help\/#\/schema\/logo\/image\/","url":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2018\/12\/leadshook-logo.png","contentUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2018\/12\/leadshook-logo.png","width":350,"height":83,"caption":"LeadsHook"},"image":{"@id":"https:\/\/www.leadshook.com\/help\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/leadshook\/","https:\/\/x.com\/leadshook","https:\/\/www.linkedin.com\/showcase\/leadshook\/"]},{"@type":"Person","@id":"https:\/\/www.leadshook.com\/help\/#\/schema\/person\/4bfe37d814563cc729828b7055313f4d","name":"Nik T","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/48d53e68db0b1db1cd5c54a750130fb2ee0c663306ff1bd434373f1a368ef7a0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/48d53e68db0b1db1cd5c54a750130fb2ee0c663306ff1bd434373f1a368ef7a0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/48d53e68db0b1db1cd5c54a750130fb2ee0c663306ff1bd434373f1a368ef7a0?s=96&d=mm&r=g","caption":"Nik T"},"sameAs":["http:\/\/www.LeadsHook.com"],"url":"https:\/\/www.leadshook.com\/help\/author\/nik\/"}]}},"_links":{"self":[{"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/posts\/2795","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/comments?post=2795"}],"version-history":[{"count":19,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/posts\/2795\/revisions"}],"predecessor-version":[{"id":7081,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/posts\/2795\/revisions\/7081"}],"wp:attachment":[{"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/media?parent=2795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/categories?post=2795"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/tags?post=2795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}