{"id":11357,"date":"2016-03-08T10:27:41","date_gmt":"2016-03-08T15:27:41","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=11357"},"modified":"2016-03-08T10:27:41","modified_gmt":"2016-03-08T15:27:41","slug":"oracle-sql-examples-find-next-or-previous-date","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=11357","title":{"rendered":"Oracle SQL Examples: Find Next or Previous Date"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Overview\">Overview<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Find_Next_Sunday_from_Today\">Find Next Sunday from Today<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Find_Next_Sunday_from_a_Specific_Date\">Find Next Sunday from a Specific Date<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Find_Next_Monday_from_Today\">Find Next Monday from Today<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Frind_Previous_Sunday_from_Today\">Frind Previous Sunday from Today<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#Frind_Previous_Sunday_from_a_Specific_Date\">Frind Previous Sunday from a Specific Date<\/a>\n\t<\/li>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Overview\"><h2>Overview<\/h2><\/span>\n<p>* Use <em>next_day<\/em> function: <em>next_day(date, day_string)<\/em><br \/>\n* <em>day_string<\/em> is one of the following:<\/p>\n<pre>\r\nSUNDAY\r\nMONDAY\r\nTUESDAY\r\nWEDNESDAY\r\nTHURSDAY\r\nFRIDAY\r\nSATURDAY\r\n<\/pre>\n<span id=\"Find_Next_Sunday_from_Today\"><h2>Find Next Sunday from Today<\/h2><\/span>\n<pre lang=\"sql\">\r\nselect next_day(SYSDATE,'SUNDAY') from dual;\r\n<\/pre>\n<span id=\"Find_Next_Sunday_from_a_Specific_Date\"><h2>Find Next Sunday from a Specific Date<\/h2><\/span>\n<pre lang=\"sql\">\r\nselect next_day(to_date('05-MAR-16'),'SUNDAY') from dual;\r\n-- or\r\nselect next_day('05-MAR-16','SUNDAY') from dual;\r\n<\/pre>\n<span id=\"Find_Next_Monday_from_Today\"><h2>Find Next Monday from Today<\/h2><\/span>\n<pre lang=\"sql\">\r\nselect next_day(SYSDATE,'MONDAY') from dual;\r\n<\/pre>\n<span id=\"Frind_Previous_Sunday_from_Today\"><h2>Frind Previous Sunday from Today<\/h2><\/span>\n<pre lang=\"sql\">\r\nselect next_day(SYSDATE-7,'SUNDAY') from dual;\r\n<\/pre>\n<span id=\"Frind_Previous_Sunday_from_a_Specific_Date\"><h2>Frind Previous Sunday from a Specific Date<\/h2><\/span>\n<pre lang=\"sql\">\r\nselect next_day(to_date('05-MAR-16')-7,'SUNDAY') from dual;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Overview * Use next_day function: next_day(date, day_string) * day_string is one of the following: SUNDAY MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY Find Next Sunday from Today select next_day(SYSDATE,&#8217;SUNDAY&#8217;) from dual; Find Next Sunday from a Specific Date select next_day(to_date(&#8217;05-MAR-16&#8242;),&#8217;SUNDAY&#8217;) from &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=11357\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[35],"tags":[684,567,683],"class_list":["post-11357","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-date","tag-oracle","tag-sql"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-2Xb","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/11357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11357"}],"version-history":[{"count":2,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/11357\/revisions"}],"predecessor-version":[{"id":11359,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/11357\/revisions\/11359"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}