Questions tagged [timestamp]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
1answer
993 views

When does next Cron Job run (time from now)?

I would need to know how much time is left between now and the next time a specifc Cron Job is done. For another answer I built a basic cron inspector plugin which can be found here. Reason I'm ...
4
votes
2answers
3k views

wp_schedule_event will it run if timestamp has passed?

I've been told by my clients that scheduled jobs are not run some times as expected. I never questioned myself about how wp_cron actually works, I thought it was kinda self-explanatory. But now I ...
4
votes
2answers
7k views

How can i put "posted x minutes ago on my posts?

wordpress by default writes the the date on posts, but how can I transform it to : "x" time ago ?? like 3 days ago, or 5 minutes ago ??
4
votes
1answer
3k views

Modify human_time_diff() to shorten “days” to “d” and “hours” to “h” etc

I'm using the function echo time_ago() that displays the time like this: 5 days ago what's the best way to change it to 5d ago ? My research led me to human_time_diff() function located in "...
3
votes
1answer
9k views

Change HTML Produced by wp_list_comments()

I am developing a WordPress theme for which I would like each comment's timestamp wrapped in in a <span> element for the sake of styling it with CSS rules. However, the wp_list_comments() ...
3
votes
3answers
5k views

Why time functions show invalid time zone when using 'c' time format?

These are the functions I use in my theme to display the "entry-meta" which includes published and last modified dates (among others) of an article: // Shows Author and Published Date if ( ! ...
3
votes
3answers
3k views

Is it safe to use 'date_default_timezone_set' in plugin file?

I am using a sitemaps plugin which in very complex ways sets the timezone of <lastmod> (i.e. last modified time) for posts to GMT. Temporarily, until the plugin developer fixes it, I need to ...
3
votes
1answer
187 views

Add 20yrs to post date, and then query

I would like to know if anyone knows a way of adding a timeframe (say 20 years) to the datestamp on a set of posts, and then running a query on the loop which uses the new date? Basically what I want ...
2
votes
2answers
832 views

Display date only once for a each set of posts relating to that date

The following loop works great for me in getting posts with a given date with the use of the_time(...): <?php $myPost = new WP_Query( array( 'posts_per_page' => '50', 'orderby' =>...
2
votes
1answer
2k views

custom field value date convert to unix timestamp problems

For some reason, I'm having difficulty converting a date value stored in a meta field to a unix timestamp (and back again). If I save the date as a string it all works fine, but if I convert it to a ...
2
votes
1answer
1k views

Finding difference in days

I want to store the current time using the update_option and then compare it if the set time was 3 days ago. I want to know in what format I should store the time? and then how can I compare it with ...
2
votes
2answers
504 views

Relative Time On Posts

I am looking for a way that I could add some code to my wordpress template to display the time of a post in relative terms. So if, for example, I posted something 5 minutes ago it would say something ...
2
votes
3answers
2k views

Date, Time, and Timezones

I am a bit confused about using dates/times along with timezones in WordPress. I have the following questions: What is the purpose of the timezone setting in the Admin -> Settings section? Assume ...
2
votes
1answer
357 views

Query by custom dates in UNIX Time

I actually have a custom date registered in UNIX Time in my database like this: meta_key : custom_date meta_value : 1322697600 and the type of the meta key is a longtext I would like to retrieve ...
2
votes
1answer
202 views

filter date and time to differents time zone

Any way to filter/change the display time only on the front-end with hook? Unfortunately, I can't adjust the timezone in General>Settings because it sets imported posts using Zulu as scheduled ...
2
votes
0answers
30 views

Is there a reliable way to keep track of how long a WordPress theme has been active?

I want to keep track of how long a specific WordPress theme has been active, not just installed. The end goal being I want to display a notice after a user has created x number of posts and the theme ...
2
votes
1answer
534 views

How to make debug.log timestamps local time?

I look at the debug.log file a lot while developing, and having all the timestamps in UTC drives me crazy! How can I get them to display in local time? I have my php.ini 'date_timezone' value set to ...
1
vote
2answers
4k views

WP Cron job every 1st and 15th of the month

Trying to set up custom schedules for WP Cron, knowing that they use an interval is it even possible to set up a cron job for every first of the month? As well as every fifteenth. This is what I have ...
1
vote
1answer
3k views

Converting Unix timestamp to wordpress date

I have trouble converting Unix timestamp (i.e. 1473897600) to Wordpress friendly date which displays at the date input field. I have a frontpage, post edit panel which is showing Unix timestamp. I ...
1
vote
1answer
30 views

Wordpress outputs mm/dd but it should be opposite

As an example, after update 4.9.5, my wordpress site outputs this timestamp in timezone settings: 2018-04-05 (5th of april) My site is set to Danish, and in Denmark the timeformat is dd/mm. The ...
1
vote
2answers
920 views

How to use Internationalized human_time_diff() function in Chinese?

Looking at https://codex.wordpress.org/Function_Reference/human_time_diff I'm using an English version of Wordpress. In my theme template, I would like to define custom text of min, hour, day, week, ...
1
vote
1answer
40 views

Swatch Internet Time for article timestamps

The date and time when the article was published is shown below the article title. How do I show Swatch Internet Time there instead of local time?
1
vote
1answer
1k views

Register script/style: Is it possible to customize the version query string via plugin?

Expanding on the question in the title: I would like to find a way (via a plugin) to use timestamps for the JS and CSS file version query strings that are output with wp_register_style and ...
1
vote
1answer
2k views

Save metadata as a timestamp, display as a “pretty” date

I have a custom meta box, its just a straight-up text field, for an event date, formatted: YYYY/MM/DD ...I'd like to save that as a date stamp (so i can sort by event date), and display just the ...
1
vote
1answer
2k views

timestamp and scheduled post irregularities

Update: I've confirmed the problem (that scheduled posts are based on UTC time), now just need advice and background to determine best solution. Questions: 1) how WP determines UTC time before ...
1
vote
1answer
31 views

display month in french in wordpress/php?

I am working on a php code as shown below: <?php <time datetime="<?php echo esc_attr(date_format($ts, 'H:i d-m-Y')) ?>" data-timezone="<?php echo esc_attr($tz_param) ?>"><?...
1
vote
1answer
30 views

About Time conditionals

I'm trying to compare times like: if this post was posted between the past 6months show human_time_diff() else show the_time('j. M .Y') my idea was: function time_ago() { global $post; $...
1
vote
2answers
5k views

Individually styling date month year [closed]

I am using underscore_s barebone theme to build mine and came across this challenge that I would like to style date month and year separately with CSS and the code output puts them together. I dug ...
1
vote
1answer
3k views

Relative time - how to calculate difference beween post publish date and current time

I want to calculate the difference between post's publishing time and current time, and I want to read that value as a number (number of hours, minutes, seconds whatever, i just want it to be a number)...
1
vote
1answer
1k views

How to add a new meta key and assign timestamp to posts

I've been trying to look for a way to create a loop in my website and show posts being read/watched but have not found anything. The only way I can accomplish this would be to create a new meta key (...
1
vote
2answers
201 views

How to find time last viewed?

I want to run an update script on pages that haven't been viewed and updated within X days. I'm using post meta to cache some related RSS feed data, and I want it updated once a week or two, but only ...
1
vote
0answers
15 views

Randomised Post Time

I've imported a Drupal site to Wordpress with an archive of 1000s of posts which had been backdated by adding a custom taxonomy 'Year' rather than by adjusting the post date. I've been able to remove ...
1
vote
0answers
32 views

Trouble Formatting DateTime

I've retrieved some meta information from the database, I believe that it's a Unix time stamp, made up of 10 chars. ( eg: 1498867200 (1 Jul 2017) ) I first had some trouble as it apparently came back ...
1
vote
0answers
124 views

Placed on + only date (not time)

When I create a comment or, ... you can set Placed on. For example: 20 june, 2014 on 14:23 . But I don't want the time (14:23). Only 20 june, 2014. Is this possible, and if so, how can I do this? ...
1
vote
1answer
95 views

Calling Different Custom Post Timestamps in a table

I use WordPress to run an events site that people can sign down to if they have a subscription. At the bottom of each event, if you are admin you can see a guest list with Name, Email, Tel, Avatar (...
0
votes
3answers
5k views

current_time('timestamp') seems to be different from the real current time

Does current_time('timestamp') have an issue? I am trying to get the current_time('timestamp'), and instead of giving me my current time: Jun 26 2013 14:30 It gives me: Jun 26 2013 21:30 I tried ...
0
votes
1answer
1k views

How can i display time minus 6 hours

how can i display date and time minus six hours in a post. For example now it's 23/02/2016 14:54, I need to display 23/02/2016 8:54. I'm using this in function.php of my theme: function displaydate(){...
0
votes
2answers
426 views

Human Time Diff, change mins to minutes

On my WordPress site, I am using the human time difference for the post date. If you have a post that was posted 59 minutes ago or under it appears as posted 1 min ago, 5 mins ago, or posted 35 mins ...
0
votes
2answers
918 views

Integrating Human Time Difference and Traditional Timestamps?

My goal is to use human_time_diff only when the post was added on the current day. When it wasn't, I would like to revert to the traditional timestamp (the second code). I'm unsure how this would be ...
0
votes
2answers
2k views

How to allow registered users to submit the form only 5 times per day?

Question Is there a way that my registered users (if they are not the form is hidden so I don't need that) are restricted to submit the form more than 5 times per day, or 20 per month or whatever ...
0
votes
1answer
2k views

Time & Date on Post - Time Ago Custom Function

I'm using the following custom function to display the timestamp for a post as posted "X minutes ago" or "X days ago" for 14 days and then this changes to the actual date (e.g. 17th December 2010): ...
0
votes
1answer
154 views

How get exact time difference

I have following code to get time diffrence $t1 = "1515397514"; //a timestamp value $t2 = "1515402944"; //a timestamp value echo date("M d Y H:i:s",$t1)."<br />"; //Jan 08 2018 07:45:14 echo ...
0
votes
1answer
54 views

Update File Once Every 30 Days

I'm building a plugin that requires a database file which is updated monthly. I would like to write a function that automatically replaces the old file once every 30 days. Here's what I have so far. ...
0
votes
1answer
92 views

Where does the time get pulled from in the_time()

I am currently using the following function in my footer <?php the_time( 'Y' ); ?> But the footer keeps showing 2011, instead of 2013. So where does this time stamp get called from exactly?
0
votes
1answer
2k views

datetime picker, timestamps and meta queries

I have a custom meta box with a datepicker. The datepicker outputs 2013-01-17 10:00 in my database for an event that is 01-17-2013 at 10pm PST. $eventlist = new WP_Query(array( 'post_type' => '...
0
votes
3answers
1k views

Human time difference in months instead of days. How?

I use the following code in my template. <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago'; ?> It shows like 2 days ago, 20 days ago, 90 days ago. Is there a ...
0
votes
1answer
53 views

Why am I seeing 'true' next to these timestamps?

Click on the Beers tab on this page: http://beernews.org/brewery/sierra-nevada-brewing/ UPDATE: Here is the Pastebin for Excerpt.php. Note that excerpt.php is called in other places on the site (like ...
0
votes
1answer
188 views

How to get time difference between publish date and now?

I want to get time difference like "posted 2 days ago". I know you can use the following to get the difference. human_time_diff( get_the_time('U'), current_time( 'timestamp' ) ) . ' ago'; But ...
0
votes
2answers
415 views

Function Reference/human time diff for future posts

Right now I've got future posts displayed on my site, and I was using this code on each post to show when it was published. <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ...
0
votes
2answers
113 views

How to show different timestamp

I would like to show published time "Posted 4:15pm" for the first 24 hours, after 24hours show full published date and time "September 27, 2016 at 4:15pm" Any suggestions? Thanks in advance