{"id":71,"date":"2011-11-01T10:24:57","date_gmt":"2011-11-01T10:24:57","guid":{"rendered":"http:\/\/www.sandykadam.com\/?p=71"},"modified":"2012-01-03T12:04:27","modified_gmt":"2012-01-03T12:04:27","slug":"date-format-validation-in-php","status":"publish","type":"post","link":"https:\/\/www.sandykadam.com\/blog\/programming-stuff\/php\/date-format-validation-in-php\/","title":{"rendered":"Date format validation in PHP"},"content":{"rendered":"<p>Function to validate a date in \u201cYYYY-MM-DD\u201d format.<\/p>\n<p>[code type=php]<br \/>\nfunction checkDateFormat($date)<br \/>\n{<br \/>\n\/\/match the format of the date<br \/>\nif (preg_match (&#8220;\/^([0-9]{4})-([0-9]{2})-([0-9]{2})$\/&#8221;, $date, $parts))<br \/>\n{<br \/>\n\/\/check weather the date is valid of not<br \/>\nif(checkdate($parts[2],$parts[3],$parts[1]))<br \/>\nreturn true;<br \/>\nelse<br \/>\nreturn false;<br \/>\n}<br \/>\nelse<br \/>\nreturn false;<br \/>\n}<br \/>\n[\/code]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Function to validate a date in \u201cYYYY-MM-DD\u201d format.<br \/>\n[code type=php]<br \/>\nfunction checkDateFormat($date)<br \/>\n{<br \/>\n\/\/match &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":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","enabled":false},"version":2}},"categories":[24],"tags":[47],"class_list":["post-71","post","type-post","status-publish","format-standard","hentry","category-php","tag-date"],"aioseo_notices":[],"views":2901,"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p25uYH-19","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/posts\/71","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/comments?post=71"}],"version-history":[{"count":4,"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/posts\/71\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/posts\/71\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/media?parent=71"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/categories?post=71"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sandykadam.com\/blog\/wp-json\/wp\/v2\/tags?post=71"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}