{"id":27,"date":"2010-08-21T08:50:39","date_gmt":"2010-08-21T08:50:39","guid":{"rendered":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/?p=27"},"modified":"2010-08-21T08:50:39","modified_gmt":"2010-08-21T08:50:39","slug":"datumy-v-php","status":"publish","type":"post","link":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/datumy-v-php\/","title":{"rendered":"Datumy v PHP"},"content":{"rendered":"<div class=\"958545b2ffe6a18f89c3ac8a7be9162a\" data-index=\"3\" style=\"float: none; margin:0px;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-9849429965459928\";\r\n\/* Blog 300x250 \u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bdl\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00a1nky *\/\r\ngoogle_ad_slot = \"0479547637\";\r\ngoogle_ad_width = 300;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>N\u011bkolik funkc\u00ed pro pr\u00e1ci s datumy v PHP:<\/p>\n<p>Pokud m\u00e1me prom\u011bnnou $retezec ve form\u00e1tu DD.MM.YYYY, dostaneme z n\u00ed jednotliv\u00e9 polo\u017eky datumu n\u00e1sleduj\u00edc\u00edm zp\u016fsobem:<br \/>\n$den=substr($retezec,0,2);<br \/>\n$mesic=substr($retezec,3,2);<br \/>\n$rok=substr($retezec,6,4);<\/p>\n<p>Kdy\u017e pak chceme polo\u017eky spojit do php timestampu, pou\u017eijeme<br \/>\n$timestamp=mktime(0,0,0,$mesic,$den,$rok);<\/p>\n<p>Prvn\u00ed t\u0159i nuly ozna\u010duj\u00ed hodiny, minuty, vteriny, tak\u017ee pokud chceme ulo\u017eit posledn\u00ed vte\u0159inu dan\u00e9ho dne, pou\u017eijeme<br \/>\n$timestamp=mktime(23,59,59,$mesic,$den,$rok);<\/p>\n<p>Kdy\u017e pak z timestampu chceme dostat jednotliv\u00e9 polo\u017eky zp\u00e1tky, dostaneme je n\u00e1sleduj\u00edc\u00edm zp\u016fsobem (promenna $vyber_start_timestamp je datum v timestamp formatu:<br \/>\n$datum=strftime(&#8220;%D, %T&#8221;,$vyber_start_timestamp); (datum ve form\u00e1tu MM\/DD\/YYYY HH:MM:SS)<br \/>\n$datum2=date(&#8220;d M,Y&#8221;,$timestamp); (datum ve form\u00e1tu DD Mesic zkratka slovne, YYYY)<br \/>\n$rok=strftime(&#8220;%Y&#8221;,$vyber_start_timestamp);<br \/>\n$mesic=strftime(&#8220;%m&#8221;,$vyber_start_timestamp);<br \/>\n$kolikatyho=date(&#8220;d&#8221;,$vyber_start_timestamp);<br \/>\n$tyden=strftime(&#8220;%W&#8221;,$vyber_start_timestamp);<\/p><!--CusAds0-->\n<p>Ostatn\u00ed form\u00e1tovac\u00ed znaky funkce date() jsou:<br \/>\ny &#8230; rok jako dvoj\u010d\u00edsl\u00ed (00)<br \/>\nY &#8230; rok jako \u010dty\u0159\u010d\u00edsl\u00ed (2000)<br \/>\nL &#8230; 0 (nep\u0159estupn\u00fd rok) nebo 1 (p\u0159estupn\u00fd rok)<br \/>\nz &#8230; \u010d\u00edslo dne v roce (001-365)<br \/>\nm &#8230; \u010d\u00edslo m\u011bs\u00edce (01-12)<br \/>\nn &#8230; \u010d\u00edslo m\u011bs\u00edce (bez p\u0159\u00edpadn\u00e9 \u00favodn\u00ed nuly, 1-12)<br \/>\nM &#8230; anglick\u00e1 zkratka n\u00e1zvu m\u011bs\u00edce (Jul)<br \/>\nF &#8230; anglick\u00fd n\u00e1zev m\u011bs\u00edce (July)<br \/>\nd &#8230; \u010d\u00edslo dne v m\u011bs\u00edci (01-31)<br \/>\nj &#8230; \u010d\u00edslo dne v m\u011bs\u00edci (bez p\u0159\u00edpadn\u00e9 \u00favodn\u00ed nuly, 1-31)<br \/>\nt &#8230; po\u010det dn\u00ed v dan\u00e9m m\u011bs\u00edci (28-31)<br \/>\nS &#8230; anglick\u00e1 koncovka \u010d\u00edsla dne v m\u011bs\u00edci (st, nd, rd, th)<br \/>\nD &#8230; anglick\u00e1 zkratka n\u00e1zvu dne v t\u00fddnu (Mon)<br \/>\nl &#8230; anglick\u00fd n\u00e1zev dne v t\u00fddnu (Monday)<br \/>\nw &#8230; \u010d\u00edslo dne v t\u00fddnu (0-6 nebo 1-7 v z\u00e1vislosti na verzi PHP &#8211; ned\u011ble m\u00e1 \u010d\u00edslo 0 nebo 7)<br \/>\nh &#8230; hodiny (01-12)<br \/>\ng &#8230; hodiny (bez p\u0159\u00edpadn\u00e9 \u00favodn\u00ed nuly, 1-12)<br \/>\nH &#8230; hodiny (01-23)<br \/>\nG &#8230; hodiny (bez p\u0159\u00edpadn\u00e9 \u00favodn\u00ed nuly, 1-23)<br \/>\na &#8230; am\/pm (dopoledne\/odpoledne)<br \/>\nA &#8230; AM\/PM (dopoledne\/odpoledne)<br \/>\ni &#8230; minuty (00-59)<br \/>\ns &#8230; sekundy (00-59)<br \/>\nU &#8230; po\u010det sekund od 1. ledna 1970<br \/>\nW &#8230; \u010d\u00edslo t\u00fddne podle ISO-8601<\/p>\n<div class=\"958545b2ffe6a18f89c3ac8a7be9162a\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"pub-9849429965459928\";\r\n\/* Blog 234x60 texty, vytvo\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bdeno 10.1.11 *\/\r\ngoogle_ad_slot = \"1054435175\";\r\ngoogle_ad_width = 234;\r\ngoogle_ad_height = 60;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>N\u011bkolik funkc\u00ed pro pr\u00e1ci s datumy v PHP: Pokud m\u00e1me prom\u011bnnou $retezec ve form\u00e1tu DD.MM.YYYY, dostaneme z n\u00ed jednotliv\u00e9 polo\u017eky datumu n\u00e1sleduj\u00edc\u00edm zp\u016fsobem: $den=substr($retezec,0,2); $mesic=substr($retezec,3,2); $rok=substr($retezec,6,4); Kdy\u017e pak chceme polo\u017eky spojit do php timestampu, pou\u017eijeme $timestamp=mktime(0,0,0,$mesic,$den,$rok); Prvn\u00ed t\u0159i nuly ozna\u010duj\u00ed hodiny, minuty, vteriny, tak\u017ee pokud chceme ulo\u017eit posledn\u00ed vte\u0159inu dan\u00e9ho dne, pou\u017eijeme $timestamp=mktime(23,59,59,$mesic,$den,$rok); Kdy\u017e pak &hellip; <a href=\"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/datumy-v-php\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Datumy v PHP<\/span><\/a><\/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":[24,23],"class_list":["post-27","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-datumy-v-php","tag-php"],"_links":{"self":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts\/27","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":1,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":28,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions\/28"}],"wp:attachment":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}