Articles of date time

Calculate future date

I want to calculate a future date based on the date the post is published and use it in the content of a post. I can echo the post publication date using: echo the_date(‘Y-m-d’); How can I calculate the future date?

Displaying year, month and day archives differently

I’d like to display daily archives differently than monthly/yearly archives. How do I check to see if the archive template is being pulled for a daily archive vs. a monthly/yearly archive?

Show modified time if post is actually modified

I want to display post updated time only if post is modified, I am using function the_modified_time() . So I just read about that there is if statement that can be used to check if post is even modified that looks like this: if (get_the_modified_time() != get_the_time()) So I put this in my template where […]

Use touch_time() on front-end form via plugin

I’m working on a plug-in that let people create posts from front-end form. I want to add date&time fields in the form using touch_time() but don’t know how to use it on front-end. I have <div id=”timestampdiv” class=”hide-if-js”><?php touch_time(0, 0, 5); ?></div> on the front-end form which giving me an error message Fatal error: Call […]

Convert a date to ISO8601 date format

This is more of a PHP question than a WordPress one. I have a custom post type event that by default outputs the date as “September 11, 2011 9:00 am” format. I’m trying to format the post in http://schema.org/Event format, I have converted every other part of the post to that format (place,address, etc) except […]

wrong php date()?

hey guys, it’s weird and I’ve never experienced that before. I’ve created a new blog and a custom theme. I’m using <?php echo date(“H:i”); ?>in my theme. The time that’s put is 2h earlier. e.g. if it’s actually 16:00 o’clock the date generated with date() is 14:00. I don’t know why that happens? I’m using […]

Last time a user logged in

I’m building a site where users log in to view content specific to them. I would like to display the last date and time they logged in. How would I get this information from wordpress? If it doesn’t exist, how could I add it? Example: Welcome Back! Your last visit was on 10/25/2010 at 3:14pm. […]

How to get the date of a post in WordPress, so I could use it in a script?

I’m very new to WordPress. I need to get the date of a post and compare that date to a specific date (04/01/2011), so add some banners and stuff to every post created “after” that pivot date. But the only functions I found in the wordpress documentation are examples of functions to “print” the date, […]

PHP function showing wrong time in WordPress

My local WordPress installation on XAMPP seems to have a wrong time setting. When I do date( ‘Y-m-d H:i:s’ ); I get 2017-02-21 10:46:43 as result. However my PCs time really is 2017-02-21 11:46:43, so my WordPress is one hour behind. Now I already did, what was recommended here and changed date.timezone in the php.ini […]

I get “The PHP Date/Time library is not supported by your web host.” on my CentOS host, what library to I need to install to add support?

I did some quick looking around, but my PHP skills are pretty nascent. I am sure there is just a package that needs installing. Edit to add additional information about the setup: Using: yum info php I get the version of PHP as 5.1.6: Name : php Arch : i386 Version : 5.1.6 More information, […]