{"id":735,"date":"2012-04-21T08:44:26","date_gmt":"2012-04-21T16:44:26","guid":{"rendered":"http:\/\/seedcodenext.wordpress.com\/?p=735"},"modified":"2012-04-21T08:44:26","modified_gmt":"2012-04-21T16:44:26","slug":"executesql-date-formats","status":"publish","type":"post","link":"https:\/\/seedcode.com\/executesql-date-formats\/","title":{"rendered":"ExecuteSQL &#8211; Date Formats"},"content":{"rendered":"<p><strong>The problem.<\/strong><\/p>\n<p>SQL, including the new ExecuteSQL calc function in FileMaker 12, returns dates in this format: YYYY-MM-DD. This can be a bit of a pain if you have a string of text like this and just want to transform the date part:<\/p>\n<pre style=\"padding-left:30px;\">1170 - 2012-03-09 - - Keep: Beta Presentation @ BRN Co<\/pre>\n<pre style=\"padding-left:30px;\">1171 - 2012-03-15 - 08:30:00 - Call Arthur Murray to finalize data<\/pre>\n<pre style=\"padding-left:30px;\">1172 - 2012-03-16 - 12:30:00 - Conference call with Melinda<\/pre>\n<pre style=\"padding-left:30px;\">1173 - 2012-03-20 - 11:15:00 - @ Breakfast<\/pre>\n<p>The calc for the results above looks like this:\u00a0ExecuteSQL ( &#8220;SELECT id, DateStart, TimeStart, Summary from SampleEvents&#8221; ; &#8221; &#8211; &#8221; ; &#8220;\u00b6&#8221; )<\/p>\n<p><strong>The solution.<\/strong><\/p>\n<p>Jason Young discovered that you can <span style=\"text-decoration:underline;\">cast the dates as text<\/span> in your results simply by concatenating them with a bit of text, so instead of using just the field DateStart in your query, you can use &#8221; || DateStart to get this:<\/p>\n<pre style=\"padding-left:30px;\">1170 - 3\/9\/2012 - - Keep: Beta Presentation @ BRN Co<\/pre>\n<pre style=\"padding-left:30px;\">1171 - 3\/15\/2012 - 08:30:00 - Call Arthur Murray to finalize data<\/pre>\n<pre style=\"padding-left:30px;\">1172 - 3\/16\/2012 - 12:30:00 - Conference call with Melinda<\/pre>\n<pre style=\"padding-left:30px;\">1173 - 3\/20\/2012 - 11:15:00 - @ Breakfast<\/pre>\n<p>The calc for those results looks like this:\u00a0ExecuteSQL ( &#8220;SELECT id, &#8221; || DateStart, TimeStart, Summary from SampleEvents&#8221; ; &#8221; &#8211; &#8221; ; &#8220;\u00b6&#8221; )<\/p>\n<p>Yes, FileMaker supports concatenate in it&#8217;s select statements.<\/p>\n<p>Hope that helps.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The problem. SQL, including the new ExecuteSQL calc function in FileMaker 12, returns dates in this format: YYYY-MM-DD. This can be a bit of a pain if you have a string of text like this and just want to transform the date part: 1170 &#8211; 2012-03-09 &#8211; &#8211; Keep: Beta Presentation @ BRN Co 1171 &#8211; 2012-03-15 &#8211; 08:30:00 &#8211; Call Arthur Murray to finalize data 1172 &#8211; 2012-03-16 &#8211; 12:30:00 &#8211; Conference call with Melinda 1173 &#8211; 2012-03-20 &#8211; 11:15:00 &#8211; @ Breakfast The calc for the results above looks like this:\u00a0ExecuteSQL ( &#8220;SELECT id, DateStart, TimeStart, Summary from SampleEvents&#8221; ; &#8221; &#8211; &#8221; ; &#8220;\u00b6&#8221; ) The solution. Jason Young discovered that you can cast the dates as text in your results simply by concatenating them with a bit of text, so instead of using just the field DateStart in your query, you can use &#8221; || DateStart to get this: 1170 &#8211; 3\/9\/2012 &#8211; &#8211; Keep: Beta Presentation @ BRN Co 1171 &#8211; 3\/15\/2012 &#8211; 08:30:00 &#8211; Call Arthur Murray to finalize data 1172 &#8211; 3\/16\/2012 &#8211; 12:30:00 &#8211; Conference call with Melinda 1173 &#8211; 3\/20\/2012 &#8211; 11:15:00 &#8211; @ Breakfast The calc for those results looks like this:\u00a0ExecuteSQL ( &#8220;SELECT id, &#8221; || DateStart, TimeStart, Summary from SampleEvents&#8221; ; &#8221; &#8211; &#8221; ; &#8220;\u00b6&#8221; ) Yes, FileMaker supports concatenate in it&#8217;s select statements. Hope that helps.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[17,18],"class_list":["post-735","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-filemaker-12","tag-filemaker-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FileMaker SQL Date Formats - SeedCode<\/title>\n<meta name=\"description\" content=\"The new ExecuteSQL calc function in FileMaker returns dates in this format: YYYY-MM-DD. Get around this by casting the results as text.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/seedcode.com\/executesql-date-formats\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FileMaker SQL Date Formats - SeedCode\" \/>\n<meta property=\"og:description\" content=\"The new ExecuteSQL calc function in FileMaker returns dates in this format: YYYY-MM-DD. Get around this by casting the results as text.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/seedcode.com\/executesql-date-formats\/\" \/>\n<meta property=\"og:site_name\" content=\"SeedCode\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/seedcoder\" \/>\n<meta property=\"article:published_time\" content=\"2012-04-21T16:44:26+00:00\" \/>\n<meta name=\"author\" content=\"seedcode\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dayback\" \/>\n<meta name=\"twitter:site\" content=\"@dayback\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"seedcode\" \/>\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:\/\/seedcode.com\/executesql-date-formats\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/seedcode.com\/executesql-date-formats\/\"},\"author\":{\"name\":\"seedcode\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f\"},\"headline\":\"ExecuteSQL &#8211; Date Formats\",\"datePublished\":\"2012-04-21T16:44:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/seedcode.com\/executesql-date-formats\/\"},\"wordCount\":136,\"commentCount\":27,\"publisher\":{\"@id\":\"https:\/\/seedcode.com\/#organization\"},\"keywords\":[\"FileMaker 12\",\"FileMaker SQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/seedcode.com\/executesql-date-formats\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/seedcode.com\/executesql-date-formats\/\",\"url\":\"https:\/\/seedcode.com\/executesql-date-formats\/\",\"name\":\"FileMaker SQL Date Formats - SeedCode\",\"isPartOf\":{\"@id\":\"https:\/\/seedcode.com\/#website\"},\"datePublished\":\"2012-04-21T16:44:26+00:00\",\"description\":\"The new ExecuteSQL calc function in FileMaker returns dates in this format: YYYY-MM-DD. Get around this by casting the results as text.\",\"breadcrumb\":{\"@id\":\"https:\/\/seedcode.com\/executesql-date-formats\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/seedcode.com\/executesql-date-formats\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/seedcode.com\/executesql-date-formats\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/seedcode.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ExecuteSQL &#8211; Date Formats\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/seedcode.com\/#website\",\"url\":\"https:\/\/seedcode.com\/\",\"name\":\"SeedCode\",\"description\":\"Build the Software You&#039;ve Always Wanted\",\"publisher\":{\"@id\":\"https:\/\/seedcode.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/seedcode.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/seedcode.com\/#organization\",\"name\":\"SeedCode\",\"url\":\"https:\/\/seedcode.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png\",\"contentUrl\":\"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png\",\"width\":595,\"height\":189,\"caption\":\"SeedCode\"},\"image\":{\"@id\":\"https:\/\/seedcode.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/seedcoder\",\"https:\/\/x.com\/dayback\",\"https:\/\/www.linkedin.com\/company\/seedcode\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f\",\"name\":\"seedcode\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/seedcode.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g\",\"caption\":\"seedcode\"},\"sameAs\":[\"https:\/\/seedcode.com\"],\"url\":\"https:\/\/seedcode.com\/author\/seedcode\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"FileMaker SQL Date Formats - SeedCode","description":"The new ExecuteSQL calc function in FileMaker returns dates in this format: YYYY-MM-DD. Get around this by casting the results as text.","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:\/\/seedcode.com\/executesql-date-formats\/","og_locale":"en_US","og_type":"article","og_title":"FileMaker SQL Date Formats - SeedCode","og_description":"The new ExecuteSQL calc function in FileMaker returns dates in this format: YYYY-MM-DD. Get around this by casting the results as text.","og_url":"https:\/\/seedcode.com\/executesql-date-formats\/","og_site_name":"SeedCode","article_publisher":"https:\/\/www.facebook.com\/seedcoder","article_published_time":"2012-04-21T16:44:26+00:00","author":"seedcode","twitter_card":"summary_large_image","twitter_creator":"@dayback","twitter_site":"@dayback","twitter_misc":{"Written by":"seedcode","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/seedcode.com\/executesql-date-formats\/#article","isPartOf":{"@id":"https:\/\/seedcode.com\/executesql-date-formats\/"},"author":{"name":"seedcode","@id":"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f"},"headline":"ExecuteSQL &#8211; Date Formats","datePublished":"2012-04-21T16:44:26+00:00","mainEntityOfPage":{"@id":"https:\/\/seedcode.com\/executesql-date-formats\/"},"wordCount":136,"commentCount":27,"publisher":{"@id":"https:\/\/seedcode.com\/#organization"},"keywords":["FileMaker 12","FileMaker SQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/seedcode.com\/executesql-date-formats\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/seedcode.com\/executesql-date-formats\/","url":"https:\/\/seedcode.com\/executesql-date-formats\/","name":"FileMaker SQL Date Formats - SeedCode","isPartOf":{"@id":"https:\/\/seedcode.com\/#website"},"datePublished":"2012-04-21T16:44:26+00:00","description":"The new ExecuteSQL calc function in FileMaker returns dates in this format: YYYY-MM-DD. Get around this by casting the results as text.","breadcrumb":{"@id":"https:\/\/seedcode.com\/executesql-date-formats\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/seedcode.com\/executesql-date-formats\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/seedcode.com\/executesql-date-formats\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/seedcode.com\/"},{"@type":"ListItem","position":2,"name":"ExecuteSQL &#8211; Date Formats"}]},{"@type":"WebSite","@id":"https:\/\/seedcode.com\/#website","url":"https:\/\/seedcode.com\/","name":"SeedCode","description":"Build the Software You&#039;ve Always Wanted","publisher":{"@id":"https:\/\/seedcode.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/seedcode.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/seedcode.com\/#organization","name":"SeedCode","url":"https:\/\/seedcode.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seedcode.com\/#\/schema\/logo\/image\/","url":"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png","contentUrl":"https:\/\/seedcode.com\/wp-content\/uploads\/2022\/12\/SeedCodeLogo.png","width":595,"height":189,"caption":"SeedCode"},"image":{"@id":"https:\/\/seedcode.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/seedcoder","https:\/\/x.com\/dayback","https:\/\/www.linkedin.com\/company\/seedcode\/"]},{"@type":"Person","@id":"https:\/\/seedcode.com\/#\/schema\/person\/af42f3f8cbfc8652fb0ffbb3f46f260f","name":"seedcode","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/seedcode.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f0c386c5b845ee7fe111b36b2d87e983811f1f549682de9597a934b9dfd45469?s=96&d=mm&r=g","caption":"seedcode"},"sameAs":["https:\/\/seedcode.com"],"url":"https:\/\/seedcode.com\/author\/seedcode\/"}]}},"_links":{"self":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/posts\/735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/comments?post=735"}],"version-history":[{"count":0,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/posts\/735\/revisions"}],"wp:attachment":[{"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/media?parent=735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/categories?post=735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seedcode.com\/wp-json\/wp\/v2\/tags?post=735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}