{"id":4725,"date":"2012-10-10T17:00:28","date_gmt":"2012-10-10T17:00:28","guid":{"rendered":"https:\/\/www.snapsurveys.com\/support-snap11\/?page_id=4725"},"modified":"2018-10-04T14:52:55","modified_gmt":"2018-10-04T13:52:55","slug":"calculating-number-days-dates","status":"publish","type":"page","link":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/","title":{"rendered":"Calculating the Number of Days between Two Dates"},"content":{"rendered":"<p>Calculating the number of days between two dates is easy as this worksheet shows.<\/p>\n<p>The example we will use is of a vacation questionnaire where we want to find the period of time the respondent has spent on vacation. In addition, there is a requirement to determine the average length of stay by age of respondent and to group the period away into useful bands.<\/p>\n<p>The original questionnaire asked for the date when respondents went on vacation, the date they returned and the age of the respondent.<\/p>\n<h3>Step By Step<\/h3>\n<div>\n<h3>Step 1<\/h3>\n<p>Enter two open ended, date response questions, one for vacation departure date and one for the vacation return date. Then create Q3 using a multiple-choice, single response question to capture respondent&#8217;s ages. You can do this easily by using the reference window\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24984\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/reference-icon1.gif\" alt=\"rereference icon\" width=\"22\" height=\"22\" \/>. Now ensure that the data has been input into Snap.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24987\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f11.gif\" alt=\"Vacation dep \/ return dates | Age\" width=\"220\" height=\"180\" srcset=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f11.gif 220w, https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f11-150x123.gif 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n<\/div>\n<div>\n<h3>Step 2<\/h3>\n<p>From the Variables window click on New Variable to create the variable that will contain the formula to work out the number of days between the two dates.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24988\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f21.gif\" alt=\"Variable Details dialog example | q2-q1\" width=\"220\" height=\"218\" srcset=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f21.gif 220w, https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f21-150x149.gif 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n<\/div>\n<div>\n<h3>Step 3<\/h3>\n<p>Enter the following information:<\/p>\n<table>\n<tbody>\n<tr>\n<td>Name:<\/td>\n<td><strong>DaysAway<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Label:<\/td>\n<td><strong>Days Away on Vacation<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Type:<\/td>\n<td><strong>Derived<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Response:<\/td>\n<td><strong>Quantity<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Text:<\/td>\n<td><strong>Days Away on Vacation<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>In the Values column, in the same row as Valid, type Q2-Q1. This will calculate the amount of days between holiday departure date and holiday return date.<\/p>\n<\/div>\n<h3>Creating a table to show the average length of stay by age<\/h3>\n<p>This is one way that you could display the results of the data.<\/p>\n<div>\n<h3>Step 1<\/h3>\n<p>Click on Results Table <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24986\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/results-table-icon2.gif\" alt=\"results table icon\" width=\"24\" height=\"22\" \/>.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24989\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f31.gif\" alt=\"Results Definition dialog\" width=\"220\" height=\"188\" srcset=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f31.gif 220w, https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f31-150x128.gif 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n<\/div>\n<div>\n<h3>Step 2<\/h3>\n<p>Change the Calculate field from Counts and Percents to Means and Significances.<\/p>\n<\/div>\n<div>\n<h3>Step 3<\/h3>\n<p>Type the Q3 into Analysis and DaysAway into the box to the right of Means &amp; Significances.<\/p>\n<\/div>\n<div>\n<h3>Step 4<\/h3>\n<p>Click\u00a0<strong>OK<\/strong>\u00a0to show results.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24990\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f41.gif\" alt=\"Length of stay by age\" width=\"220\" height=\"296\" srcset=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f41.gif 220w, https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f41-150x202.gif 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n<\/div>\n<h3>Grouping the number of days on vacation into useful bands.<\/h3>\n<p>This will categorise the data so that a table or chart can be produced.<\/p>\n<div>\n<h3>Step 1<\/h3>\n<p>From the\u00a0<strong>Variables<\/strong>\u00a0window <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22698\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2016\/07\/VariablesButton.png\" alt=\"multiples icon\" width=\"24\" height=\"22\" \/>\u00a0click New Variable <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22699\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2016\/07\/Plus.png\" alt=\"plus | add\" width=\"24\" height=\"22\" \/>\u00a0to create the variable to show the amount of days from the departure date to the return date.<\/p>\n<\/div>\n<div>\n<h3>Step 2<\/h3>\n<p>Enter the following information:<\/p>\n<table>\n<tbody>\n<tr>\n<td>Name:<\/td>\n<td><strong>Length<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Label:<\/td>\n<td><strong>Length of Vacation<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Type:<\/td>\n<td><strong>Numeric<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Response:<\/td>\n<td><strong>Single<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<h3>Step 3<\/h3>\n<p>Click in the Label field for Code 1 and type out the first answer e.g. 1 to 3 days. Press Tab on the keyboard, this will jump to the Values column. In this column Snap needs to know what numbers are to be displayed in this answer e.g. 1 to 3. Follow the same procedure to create categories for 4 to 6 days, 7 to 10 days and over 10 days.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24991\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f52.gif\" alt=\"Variable Details dialog example | 1-3 days\" width=\"220\" height=\"221\" srcset=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f52.gif 220w, https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f52-150x151.gif 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n<\/div>\n<div>\n<h3>Step 4<\/h3>\n<p>Click on Toggle Details\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-20192\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2015\/09\/desmode.png\" alt=\"Design mode button\" width=\"20\" height=\"18\" \/>\u00a0and change Source to DaysAway.<\/p>\n<\/div>\n<div>\n<h3>Step 5<\/h3>\n<p>Click Keep changes\u00a0<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-22703\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2016\/07\/Save.png\" alt=\"Save\" width=\"24\" height=\"22\" \/>\u00a0to save.<\/p>\n<\/div>\n<div>\n<h3>Step 6<\/h3>\n<p>Click on Results Table <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24986\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/results-table-icon2.gif\" alt=\"results table icon\" width=\"24\" height=\"22\" \/>\u00a0or Results Chart <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24985\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/results-definition-icon1.gif\" alt=\"results icon\" width=\"24\" height=\"22\" \/>\u00a0to show the results definition window.<\/p>\n<\/div>\n<div>\n<h3>Step 7<\/h3>\n<p>Type the word Length into Analysis. Click\u00a0<strong>OK<\/strong>\u00a0to show results.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-24992\" src=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f61.gif\" alt=\"Length of Vacation\" width=\"220\" height=\"231\" srcset=\"https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f61.gif 220w, https:\/\/www.snapsurveys.com\/support-snap11\/wp-content\/uploads\/2017\/03\/ws8_f61-150x158.gif 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/p>\n<\/div>\n<p>If there is a topic you would like a worksheet on, email to <a title=\"\" href=\"mailto:snapideas@snapsurveys.com\" target=\"_self\">snapideas@snapsurveys.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><a class=\"ninja_pages_read_more\"  href=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/\"><\/a><\/p>\n","protected":false},"author":10,"featured_media":0,"parent":43,"menu_order":129,"comment_status":"open","ping_status":"closed","template":"page-templates\/child-page.php","meta":{"_acf_changed":false,"footnotes":""},"class_list":{"0":"post-4725","1":"page","2":"type-page","3":"status-publish","5":"search_category-support-hub"},"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Calculating the Number of Days between Two Dates - Snap Surveys<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Calculating the Number of Days between Two Dates - Snap Surveys\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/\" \/>\n<meta property=\"og:site_name\" content=\"Snap Surveys\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SnapSurveys\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-04T13:52:55+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@snapsurveys\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/\",\"url\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/\",\"name\":\"Calculating the Number of Days between Two Dates - Snap Surveys\",\"isPartOf\":{\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/#website\"},\"datePublished\":\"2012-10-10T17:00:28+00:00\",\"dateModified\":\"2018-10-04T13:52:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.snapsurveys.com\/support-snap11\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Worksheets\",\"item\":\"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calculating the Number of Days between Two Dates\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.snapsurveys.com\/support-snap11\/#website\",\"url\":\"https:\/\/www.snapsurveys.com\/support-snap11\/\",\"name\":\"Snap Surveys\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.snapsurveys.com\/support-snap11\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Calculating the Number of Days between Two Dates - Snap Surveys","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_GB","og_type":"article","og_title":"Calculating the Number of Days between Two Dates - Snap Surveys","og_url":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/","og_site_name":"Snap Surveys","article_publisher":"https:\/\/www.facebook.com\/SnapSurveys","article_modified_time":"2018-10-04T13:52:55+00:00","twitter_card":"summary_large_image","twitter_site":"@snapsurveys","twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/","url":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/","name":"Calculating the Number of Days between Two Dates - Snap Surveys","isPartOf":{"@id":"https:\/\/www.snapsurveys.com\/support-snap11\/#website"},"datePublished":"2012-10-10T17:00:28+00:00","dateModified":"2018-10-04T13:52:55+00:00","breadcrumb":{"@id":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/calculating-number-days-dates\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.snapsurveys.com\/support-snap11\/"},{"@type":"ListItem","position":2,"name":"Worksheets","item":"https:\/\/www.snapsurveys.com\/support-snap11\/worksheets\/"},{"@type":"ListItem","position":3,"name":"Calculating the Number of Days between Two Dates"}]},{"@type":"WebSite","@id":"https:\/\/www.snapsurveys.com\/support-snap11\/#website","url":"https:\/\/www.snapsurveys.com\/support-snap11\/","name":"Snap Surveys","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.snapsurveys.com\/support-snap11\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"}]}},"_links":{"self":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/4725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/comments?post=4725"}],"version-history":[{"count":10,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/4725\/revisions"}],"predecessor-version":[{"id":24994,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/4725\/revisions\/24994"}],"up":[{"embeddable":true,"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/pages\/43"}],"wp:attachment":[{"href":"https:\/\/www.snapsurveys.com\/support-snap11\/wp-json\/wp\/v2\/media?parent=4725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}