{"id":2975,"date":"2020-05-12T14:19:08","date_gmt":"2020-05-12T14:19:08","guid":{"rendered":"https:\/\/www.leadshook.com\/help\/?p=2975"},"modified":"2024-02-14T11:51:14","modified_gmt":"2024-02-14T11:51:14","slug":"how-to-calculate-the-day-of-the-week","status":"publish","type":"post","link":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/","title":{"rendered":"How to calculate the day of the week"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction:<\/h2>\n\n\n\n<p>In some circumstances you might want to split your Decision Tree into different paths based on the day of the week.<\/p>\n\n\n\n<p>So for example Monday through Friday when you are available. While also at weekends when you are not available.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Instructions:<\/h2>\n\n\n\n<p><strong>Step 1:<\/strong> Create an answer text custom field called <strong>&#8216;weekday&#8217;<\/strong>. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image.png\" data-rel=\"lightbox-gallery-4PY0YzST\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"562\" src=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1024x562.png\" alt=\"\" class=\"wp-image-2976\" srcset=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1024x562.png 1024w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-300x165.png 300w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-768x421.png 768w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1536x842.png 1536w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-60x33.png 60w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-150x82.png 150w, https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image.png 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Step 2:<\/strong> Add this script to any node ( to fire on enter )<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;script&gt;\n  \nvar d = new Date();\nvar weekday = new Array(7);\nweekday&#91;0] = \"Sunday\";\nweekday&#91;1] = \"Monday\";\nweekday&#91;2] = \"Tuesday\";\nweekday&#91;3] = \"Wednesday\";\nweekday&#91;4] = \"Thursday\";\nweekday&#91;5] = \"Friday\";\nweekday&#91;6] = \"Saturday\";\n\nvar n = weekday&#91;d.getDay()];\n\nconsole.log(n);\nDT.setField('weekday',n);\n  \n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p><strong>Step 3:<\/strong> Now you can use the {weekday} custom field to print the current day of the week. Or use in a decision node as you like. <\/p>\n\n\n\n<p>Demo here: <a href=\"https:\/\/test2.leadshook.io\/survey\/VD2glpEVQvtX0og37RVObukRrcP6UXRqqjvTEFRO\">https:\/\/test2.leadshook.io\/survey\/VD2glpEVQvtX0og37RVObukRrcP6UXRqqjvTEFRO<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: In some circumstances you might want to split your Decision Tree into different paths based on the day of the week. So for example Monday through Friday when you are available. While also at weekends when you are not available. Step-by-Step Instructions: Step 1: Create an answer text custom field called &#8216;weekday&#8217;. Step 2: [&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":[495,653,567,654,652],"class_list":["post-2975","post","type-post","status-publish","format-standard","hentry","category-scripts","tag-current","tag-day","tag-script","tag-week","tag-weekday"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to calculate the day of the week - 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\/how-to-calculate-the-day-of-the-week\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to calculate the day of the week - LeadsHook Knowledge Base\" \/>\n<meta property=\"og:description\" content=\"Introduction: In some circumstances you might want to split your Decision Tree into different paths based on the day of the week. So for example Monday through Friday when you are available. While also at weekends when you are not available. Step-by-Step Instructions: Step 1: Create an answer text custom field called &#8216;weekday&#8217;. Step 2: [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/\" \/>\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-05-12T14:19:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-14T11:51:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1024x562.png\" \/>\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=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/\"},\"author\":{\"name\":\"Nik T\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#\\\/schema\\\/person\\\/4bfe37d814563cc729828b7055313f4d\"},\"headline\":\"How to calculate the day of the week\",\"datePublished\":\"2020-05-12T14:19:08+00:00\",\"dateModified\":\"2024-02-14T11:51:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/\"},\"wordCount\":109,\"publisher\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/image-1024x562.png\",\"keywords\":[\"current\",\"day\",\"script\",\"week\",\"weekday\"],\"articleSection\":[\"Scripts\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/\",\"name\":\"How to calculate the day of the week - LeadsHook Knowledge Base\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/image-1024x562.png\",\"datePublished\":\"2020-05-12T14:19:08+00:00\",\"dateModified\":\"2024-02-14T11:51:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/image.png\",\"contentUrl\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/image.png\",\"width\":1920,\"height\":1053},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/how-to-calculate-the-day-of-the-week\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.leadshook.com\\\/help\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to calculate the day of the week\"}]},{\"@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 calculate the day of the week - 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\/how-to-calculate-the-day-of-the-week\/","og_locale":"en_US","og_type":"article","og_title":"How to calculate the day of the week - LeadsHook Knowledge Base","og_description":"Introduction: In some circumstances you might want to split your Decision Tree into different paths based on the day of the week. So for example Monday through Friday when you are available. While also at weekends when you are not available. Step-by-Step Instructions: Step 1: Create an answer text custom field called &#8216;weekday&#8217;. Step 2: [&hellip;]","og_url":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/","og_site_name":"LeadsHook Knowledge Base","article_publisher":"https:\/\/www.facebook.com\/leadshook\/","article_published_time":"2020-05-12T14:19:08+00:00","article_modified_time":"2024-02-14T11:51:14+00:00","og_image":[{"url":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1024x562.png","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":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#article","isPartOf":{"@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/"},"author":{"name":"Nik T","@id":"https:\/\/www.leadshook.com\/help\/#\/schema\/person\/4bfe37d814563cc729828b7055313f4d"},"headline":"How to calculate the day of the week","datePublished":"2020-05-12T14:19:08+00:00","dateModified":"2024-02-14T11:51:14+00:00","mainEntityOfPage":{"@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/"},"wordCount":109,"publisher":{"@id":"https:\/\/www.leadshook.com\/help\/#organization"},"image":{"@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#primaryimage"},"thumbnailUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1024x562.png","keywords":["current","day","script","week","weekday"],"articleSection":["Scripts"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/","url":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/","name":"How to calculate the day of the week - LeadsHook Knowledge Base","isPartOf":{"@id":"https:\/\/www.leadshook.com\/help\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#primaryimage"},"image":{"@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#primaryimage"},"thumbnailUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image-1024x562.png","datePublished":"2020-05-12T14:19:08+00:00","dateModified":"2024-02-14T11:51:14+00:00","breadcrumb":{"@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#primaryimage","url":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image.png","contentUrl":"https:\/\/www.leadshook.com\/help\/wp-content\/uploads\/2020\/05\/image.png","width":1920,"height":1053},{"@type":"BreadcrumbList","@id":"https:\/\/www.leadshook.com\/help\/how-to-calculate-the-day-of-the-week\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.leadshook.com\/help\/"},{"@type":"ListItem","position":2,"name":"How to calculate the day of the week"}]},{"@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\/2975","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=2975"}],"version-history":[{"count":8,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/posts\/2975\/revisions"}],"predecessor-version":[{"id":7074,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/posts\/2975\/revisions\/7074"}],"wp:attachment":[{"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/media?parent=2975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/categories?post=2975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.leadshook.com\/help\/wp-json\/wp\/v2\/tags?post=2975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}