{"id":312,"date":"2013-08-28T14:08:18","date_gmt":"2013-08-28T14:08:18","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=312"},"modified":"2013-09-02T13:29:56","modified_gmt":"2013-09-02T13:29:56","slug":"wordpress-how-to-display-date-time-with-user-preferred-formatting","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/wordpress-how-to-display-date-time-with-user-preferred-formatting\/","title":{"rendered":"WordPress: How to Display Date and Time with User-preferred Formatting"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"313\" data-permalink=\"https:\/\/pixert.com\/blog\/wordpress-how-to-display-date-time-with-user-preferred-formatting\/wpdatetimesettings\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?fit=1028%2C727&amp;ssl=1\" data-orig-size=\"1028,727\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"wpdatetimesettings\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?fit=300%2C212&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?fit=1024%2C724&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings-300x212.jpeg?resize=300%2C212\" alt=\"wpdatetimesettings\" width=\"300\" height=\"212\" class=\"aligncenter size-medium wp-image-313\" srcset=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?resize=300%2C212&amp;ssl=1 300w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?resize=1024%2C724&amp;ssl=1 1024w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?w=1028&amp;ssl=1 1028w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\nWe set Date Format and Time Format in WordPress General Setting and we want to display that date on WordPress template. The Date Format and the Time Format settings allow us to set Date and Time  to any format we wants, it also easier to use with localization. Use following code in WordPress template<br \/>\n<strong>Date<\/strong><\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">&lt;?php the_time(get_option('date_format')); ?&gt;<\/pre>\n<p><strong>Time<\/strong><\/p>\n<pre class=\"brush: php; title: Code Block; notranslate\" title=\"Code Block\">&lt;?php the_time(get_option('time_format')); ?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We set Date Format and Time Format in WordPress General Setting and we want to display that date on WordPress template. The Date Format and the Time Format settings allow us to set Date and Time to any format we wants, it also easier to use with localization. Use following code in WordPress template Date [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":313,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"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":""},"categories":[54,5],"tags":[55,6],"class_list":["post-312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-snippet","category-wordpress","tag-code-snippet-2","tag-wordpress-2"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wpdatetimesettings.jpeg?fit=1028%2C727&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-52","jetpack-related-posts":[{"id":231,"url":"https:\/\/pixert.com\/blog\/wordpress-shortcode-in-custom-fields\/","url_meta":{"origin":312,"position":0},"title":"WordPress: Shortcode in Custom Field","author":"Pixel Insert \/ Pixert","date":"June 5, 2012","format":false,"excerpt":"Normally wordpress does not run shortcode that you put into a custom field. By default, Custom Fields display whatever value you enter, as plain-text, so if you try entering a shortcode, (in the format [shortcode] VALUE [\/shortcode]) you\u2019ll end up displaying the entire text, including the tags. Add the following\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":208,"url":"https:\/\/pixert.com\/blog\/how-to-add-a-wordpress-shortcode-outside-post-editor-php-template\/","url_meta":{"origin":312,"position":1},"title":"How to add a WordPress shortcode outside of the post editor or  PHP templates","author":"Pixel Insert \/ Pixert","date":"March 13, 2012","format":false,"excerpt":"Shortcodes were introduced back in WordPress 2.5. Shortcodes are for creating macros to be use in a posts. For instance, the following shortcode (in the post\/page content) would add a photo gallery into the page: [ \u00a0gallery \u00a0] If you want to use that shortcode outside of the WordPress post\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":227,"url":"https:\/\/pixert.com\/blog\/mp4-video-cannot-play-on-ipad-ipod-iphone-using-jw-player-shortocode\/","url_meta":{"origin":312,"position":2},"title":"MP4 video cannot play on iPad\/iPod\/iPhone using JW Player shortcode","author":"Pixel Insert \/ Pixert","date":"May 14, 2012","format":false,"excerpt":"It seems that this is a bug on JW Player for WordPress plugin We added JW Player or WordPress plugin shortcode with a mp4 video in it, the video plays on Macbooks and PCs, but it shows blank on iPad or iPod or iPhone. Although HTML5 as default mode, it\u2026","rel":"","context":"In &quot;iOS&quot;","block_context":{"text":"iOS","link":"https:\/\/pixert.com\/blog\/category\/ios\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":447,"url":"https:\/\/pixert.com\/blog\/wordpress-randomize-posts-category-page\/","url_meta":{"origin":312,"position":3},"title":"WordPress: Randomize posts in a category page","author":"Pixel Insert \/ Pixert","date":"July 19, 2016","format":false,"excerpt":"The following lines of code change the way of displaying posts in a category page from default to date to random order. Please add following lines of code to functions.php [php] add_action( 'pre_get_posts', 'random_category_posts' ); function random_category_posts( $query ) { if ( $query-&gt;is_category() &amp;&amp; $query-&gt;is_main_query() ) { $query-&gt;set( 'orderby', 'rand'\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":256,"url":"https:\/\/pixert.com\/blog\/exclude-featured-posts-from-wpzoom-featured-category-widget\/","url_meta":{"origin":312,"position":4},"title":"Exclude Featured Posts from WPZOOM: Featured Category Widget","author":"Pixel Insert \/ Pixert","date":"August 25, 2012","format":false,"excerpt":"Zenko WPZOOM Demo Site (see the documentation) I made customization to the widget to exclude Same Posts already been shown on Featured Slider to avoid duplication 1. Open featured-category.php in wp-content\/themes\/zenko\/functions\/theme\/widgets folder 2. Replace all code in featured-category.php with the following [code] <?php \/*------------------------------------------*\/ \/* WPZOOM: Featured Category widget *\/\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/08\/zenkofeapostswidget.jpg?fit=580%2C459&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/08\/zenkofeapostswidget.jpg?fit=580%2C459&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2012\/08\/zenkofeapostswidget.jpg?fit=580%2C459&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":292,"url":"https:\/\/pixert.com\/blog\/wordpress-conditional-tag-for-login-page\/","url_meta":{"origin":312,"position":5},"title":"WordPress Conditional Tag for Login Page","author":"Pixel Insert \/ Pixert","date":"March 6, 2013","format":false,"excerpt":"WordPress have conditional tags. The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches Following conditional tag is specific to Login Page, that is currently not available\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"wordpress-logo-notext-rgb","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/08\/wordpress-logo-notext-rgb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=312"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/312\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media\/313"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}