{"id":863,"date":"2012-08-08T07:40:00","date_gmt":"2012-08-08T07:40:00","guid":{"rendered":"http:\/\/www.websitedesignwebsitedevelopment.com\/?p=863"},"modified":"2014-03-19T09:13:49","modified_gmt":"2014-03-19T09:13:49","slug":"current-week-no-php-function","status":"publish","type":"post","link":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/","title":{"rendered":"Current Week No. PHP Function"},"content":{"rendered":"<h2>Current Week No. PHP Function<\/h2>\n<p><code><br \/>\nif(!function_exists('current_week_no'))<br \/>\n{<br \/>\n\tfunction current_week_no()<br \/>\n\t{<br \/>\n\t\t$current_date = date('Y-m-d');<br \/>\n\t        $date_part = explode('-', $current_date);<br \/>\n\t\t$date_part[2] = '01';<br \/>\n\t\t$start_of_month = implode('-', $date_part);<br \/>\n\t\t$day_for_first = date('N', strtotime($start_of_month));<br \/>\n\t\t$day_for_month = date('j', strtotime($current_date));<br \/>\n\t\t$current_month_current_week = floor(($day_for_first + $day_for_month - 1) \/ 7) + 1;<br \/>\n                $last_month = (date('m')-1);<br \/>\n\t\t$week_limit_of_last_month = $last_month*4;<br \/>\n\t\t$return = $week_limit_of_last_month+$current_month_current_week;<br \/>\n\t\treturn $return;<br \/>\n\t}<br \/>\n}<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Current Week No. PHP Function if(!function_exists(&#8216;current_week_no&#8217;)) { function current_week_no() { $current_date = date(&#8216;Y-m-d&#8217;); $date_part = explode(&#8216;-&#8216;, $current_date); $date_part[2] = &#8217;01&#8217;; $start_of_month = implode(&#8216;-&#8216;, $date_part); $day_for_first = date(&#8216;N&#8217;, strtotime($start_of_month)); $day_for_month = date(&#8216;j&#8217;, strtotime($current_date)); $current_month_current_week = floor(($day_for_first + $day_for_month &#8211; 1) \/ 7) + 1; $last_month = (date(&#8216;m&#8217;)-1); $week_limit_of_last_month = $last_month*4; $return = $week_limit_of_last_month+$current_month_current_week; return $return; } [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[35],"tags":[],"class_list":["post-863","post","type-post","status-publish","format-standard","hentry","category-helper-functions"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Current Week No. PHP Function<\/title>\n<meta name=\"description\" content=\"Current Week No. PHP Function\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Current Week No. PHP Function\" \/>\n<meta property=\"og:description\" content=\"Current Week No. PHP Function\" \/>\n<meta property=\"og:url\" content=\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\" \/>\n<meta property=\"og:site_name\" content=\"AndroidBubble Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453\" \/>\n<meta property=\"article:published_time\" content=\"2012-08-08T07:40:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-03-19T09:13:49+00:00\" \/>\n<meta name=\"author\" content=\"Fahad\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fahad\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\"},\"author\":{\"name\":\"Fahad\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"headline\":\"Current Week No. PHP Function\",\"datePublished\":\"2012-08-08T07:40:00+00:00\",\"dateModified\":\"2014-03-19T09:13:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\"},\"wordCount\":10,\"articleSection\":[\"Helper Functions\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\",\"url\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\",\"name\":\"Current Week No. PHP Function\",\"isPartOf\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\"},\"datePublished\":\"2012-08-08T07:40:00+00:00\",\"dateModified\":\"2014-03-19T09:13:49+00:00\",\"author\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\"},\"description\":\"Current Week No. PHP Function\",\"breadcrumb\":{\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/androidbubble.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Website Development\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"PHP Frameworks\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"CodeIgniter\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/codeigniter\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Helper Functions\",\"item\":\"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/codeigniter\/helper-functions\/\"},{\"@type\":\"ListItem\",\"position\":6,\"name\":\"Current Week No. PHP Function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#website\",\"url\":\"https:\/\/androidbubble.com\/blog\/\",\"name\":\"AndroidBubble Blog\",\"description\":\"Articles &amp; Posts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/androidbubble.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7\",\"name\":\"Fahad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g\",\"caption\":\"Fahad\"},\"sameAs\":[\"http:\/\/www.androidbubbles.com\/\",\"https:\/\/x.com\/phpFlex\"],\"url\":\"https:\/\/androidbubble.com\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Current Week No. PHP Function","description":"Current Week No. PHP Function","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:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/","og_locale":"en_US","og_type":"article","og_title":"Current Week No. PHP Function","og_description":"Current Week No. PHP Function","og_url":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/","og_site_name":"AndroidBubble Blog","article_publisher":"https:\/\/www.facebook.com\/pages\/Website-Design-Website-Development\/172363336135453","article_published_time":"2012-08-08T07:40:00+00:00","article_modified_time":"2014-03-19T09:13:49+00:00","author":"Fahad","twitter_misc":{"Written by":"Fahad"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/#article","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/"},"author":{"name":"Fahad","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"headline":"Current Week No. PHP Function","datePublished":"2012-08-08T07:40:00+00:00","dateModified":"2014-03-19T09:13:49+00:00","mainEntityOfPage":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/"},"wordCount":10,"articleSection":["Helper Functions"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/","url":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/","name":"Current Week No. PHP Function","isPartOf":{"@id":"https:\/\/androidbubble.com\/blog\/#website"},"datePublished":"2012-08-08T07:40:00+00:00","dateModified":"2014-03-19T09:13:49+00:00","author":{"@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7"},"description":"Current Week No. PHP Function","breadcrumb":{"@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/androidbubble.com\/blog\/website-development\/php-frameworks\/codeigniter\/helper-functions\/current-week-no-php-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/androidbubble.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Website Development","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/"},{"@type":"ListItem","position":3,"name":"PHP Frameworks","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/"},{"@type":"ListItem","position":4,"name":"CodeIgniter","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/codeigniter\/"},{"@type":"ListItem","position":5,"name":"Helper Functions","item":"https:\/\/androidbubble.com\/blog\/category\/website-development\/php-frameworks\/codeigniter\/helper-functions\/"},{"@type":"ListItem","position":6,"name":"Current Week No. PHP Function"}]},{"@type":"WebSite","@id":"https:\/\/androidbubble.com\/blog\/#website","url":"https:\/\/androidbubble.com\/blog\/","name":"AndroidBubble Blog","description":"Articles &amp; Posts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/androidbubble.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/0a833b633f744c3a5e0de7c9a94e71f7","name":"Fahad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/androidbubble.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afab5bcad71955d142a69df1758e6710aed4ab9cc2b5da28c54a7c3f39801b73?s=96&d=mm&r=g","caption":"Fahad"},"sameAs":["http:\/\/www.androidbubbles.com\/","https:\/\/x.com\/phpFlex"],"url":"https:\/\/androidbubble.com\/blog\/author\/admin\/"}]}},"views":331,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/comments?post=863"}],"version-history":[{"count":6,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/863\/revisions"}],"predecessor-version":[{"id":1617,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/posts\/863\/revisions\/1617"}],"wp:attachment":[{"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/media?parent=863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/categories?post=863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/androidbubble.com\/blog\/wp-json\/wp\/v2\/tags?post=863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}