Questions tagged [timestamp]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
16 views

Why does wp_query only display the most recent post when using order ASC?

Problem: I want to list posts of a category, displaying those with custom-field 'start-date' after today (in the future) with order ASC. When this is done, I want to display all those with start-date ...
  • 25
1 vote
2 answers
2k views

create timestamp links to jump to specific times on rumble videos

I am trying to allow visitors to seek specific times on the embed rumble video inside the wordpress post by clicking to timestamp links. I can do it for youtube videos using Skip to Timestamp plugin ...
  • 111
0 votes
0 answers
133 views

set_object_terms action hook based on the function in the published CPT

I want to change the term in the custom taxonomy from the set of time intervals. CPT = job, taxonomy = current-status, term = ongoing The below code is not working and I don't know the missing code. ...
  • 13
0 votes
1 answer
1k views

How to get User Time Zone in Wordpress?

how can I get user Time Zone in Wordpress if you don't know where the user comes from. Let's say if a user is in USA I need to get USA Time Zone, if the user is in Germany I need to get Germany Time ...
  • 101
0 votes
0 answers
136 views

the_modified_time showing wrong date

I have an wordpress self-hosted installation that is over 10 years old. I was updating the template files to show the last modified date instead of the published date for my posts. Old snippet: <...
  • 59
0 votes
1 answer
61 views

current_time function incorrect in plugin and PHP, not in WordPress admin

I had to reboot my server due to recurring server errors (which I couldn't find a reason for). Since rebooting, echoing current_time( 'timestamp', true ) shows the time as 14 hours before my current ...
  • 191
0 votes
2 answers
38 views

Measure time in ONLY HOUR format

I need to change the timeformat in this column to be in hours, not measured in seconds and minutes. This meaning that 30 minutes should be measured in 0.5 hours and so on. I think I need to edit this ...
1 vote
1 answer
215 views

wordpress convert timestamp to date not correctly

I use wp_date() function to convert and show dates with hours and minutes. wp_date( 'Y/m/d - H:m:s',1598205923, 'Asia/Tehran' ) My problem is it shows Y/m/d correct. the hour is ok. but it shows m:s ...
  • 201
0 votes
0 answers
60 views

Time Stamp In A Wordpress Post Title That Does Not Keep Refreshing

I have a short-code that uses PHP to echo a time stamp ala: 1595140137 When I use that short-code as the default post title in new post, the post title changes with each page refresh, and in the ...
0 votes
0 answers
30 views

Deleting guests profile users after 1.5 hours

I need to automatically delete the users that are subscribed through a wpforms after 90 minutes of being created. Users created this way are marked as "invitados" on the profile. I found ...
0 votes
1 answer
608 views

Learndash: Customize user enroll time

we use the learndash LMS and want to let users get access to lessons everyday at 6am with enrollment based access. For this purpose the LMS stores the enrollment time of every user in the db usermeta ...
  • 140
0 votes
1 answer
78 views

Cron task with scheduled timestamp in the past

I´m doing some setting to enable/disable a cron task and choose a time to run this task. When I disable the cron task and enable it after without changed the time, my timestamp is in the past and make ...
  • 800
0 votes
2 answers
2k views

Change pubDate in rss feed in another format

In the default wordpress rss feed the element <pubDate> is <pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate> ...
1 vote
1 answer
49 views

Customize Time Stamp

I'm using this nifty timestamp function that makes the post date "1 day ago" and "five minutes ago" etc. However after a few days I want it to switch to the actual date it was written so for example: ...
  • 247
1 vote
1 answer
780 views

possibility to control embedded video timeline with buttons and links external to the player

I am a designer working on a Wordpress website, currently, I need to make a page where there can be displayed an external video (can be from almost any URL) but I want to include some functionality ...
  • 31
0 votes
1 answer
31 views

Query not work for current taxonomy

Hi i want to show current taxonomy post type count by month but it show total post count istead of current tax. please help me. i am trying to solve this problem almost 3 weeks. <?php $...
  • 33
1 vote
1 answer
252 views

Update all comments time to random dates?

I found this code snippet which randomly changes all the dates for all posts. (Original Post : Update existing post dates to random dates ) <?php /** * Plugin Name: WPSE 259750 Random Dates * ...
  • 11
0 votes
1 answer
520 views

strtotime not working

So, have a plugin that's a bit busted, it's meant to do a count down till next days opening hour. It seems to be adding on an additional 1.5 hours, i've tried a few things and nothing seem to to have ...
0 votes
1 answer
156 views

Count time from registration date to today

I would like to add to the user profile the time from registration to the current day in the format: With us: 7 years 3 months 2 weeks 6 days OR With us: 1 year 1 month 1 week 1 day Me a bit ...
1 vote
1 answer
2k 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) ?>"><?...
0 votes
2 answers
305 views

Update existing post times to random times?

I have found a code here that will randomize the date of all posts to a random date. Here is the code that someone has posted: <?php /** * Plugin Name: WPSE 259750 Random Dates * Description: On ...
-1 votes
1 answer
126 views

one time visit to the page

I want to set up a page with PayPal subscription gate away to my members area. It's a simple page with PayPal button which offer discounted subscription price for the chosen customers only. ...
  • 1
0 votes
1 answer
433 views

Get system timestamp in wordpress

My system timezone is UTC+1, MySQL is using this timezone and it's ok. Now I want to get the same timestamps in WordPress. As you know, WordPress modifies the current timezone so time() returns UTC-...
0 votes
1 answer
11 views

Can't add to time? [closed]

What's the best way to add to time()? For example: time() + 5 will return 5, not the current unix timestamp with 5 added to it. Any ideas? Thanks
  • 153
0 votes
0 answers
28 views

Timezone for Plugin

I'm using these two lines: $expires = strtotime( $_POST['expire_date']); if($expires < time()) to test the time in the name=expire_date form against GMT time. But no matter what I do my expire ...
  • 153
1 vote
1 answer
109 views

How to get Unix Local Time?

I have a given time and I'd like to confirm that is AFTER the current time. $expires_epoch = strtotime($_POST['expiry']); if($expires_epoch < current_time('mysql')){ ...do stuff... This snippet ...
  • 153
0 votes
2 answers
1k views

How do I output user_registered time in my correct timezone?

I am currently using Wordpress, and an element of user_registered returns the time of registration of the user. I have set the correct timezone, but don't know how to get the user_registered output to ...
  • 1
2 votes
1 answer
4k 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 ...
1 vote
1 answer
416 views

Change wordpress current_time function to different timezone

I'm using plugin to set the earliest possible date for order delivery in woocommerce. Piece of code below: $current_time = current_time( 'timestamp' ); if( $prdd_minimum_delivery_time != '...
1 vote
0 answers
24 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 ...
  • 19
2 votes
1 answer
373 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 ...
  • 119
1 vote
1 answer
53 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 ...
2 votes
0 answers
38 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 ...
0 votes
1 answer
378 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 ...
2 votes
2 answers
1k 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' =>...
  • 804
0 votes
2 answers
598 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') ...
  • 23
1 vote
0 answers
41 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 ...
0 votes
2 answers
1k 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 ...
-2 votes
2 answers
461 views

Date is showing in unreadable format. How to convert to readable date?

I am using the following code to show the expiration date of my coupon; <?php _e('Expiration Date:','wpestate'); echo esc_html($expiration_date); ?> But, it is showing in following ...
0 votes
4 answers
4k views

current_time('timestamp') is wrong

I put my timezone in America/Lima ( Setting > General ) But current_time('timestamp') show other datetime. For example: Now in Lima it is 2015-10-25 12:01:00 but current_time('timestamp') says : ...
0 votes
1 answer
199 views

How to add a timestamp to the exported WXR filename?

I have no working code example for this, so I'm hoping to not get blasted for an an inappropriate question... Being able to add append a timestamp to WP xml exports (WXR) would be useful. I assume ...
  • 851
0 votes
2 answers
183 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
  • 1
-1 votes
1 answer
69 views

Can someone explain why wordpress uses two column for storing time values?

I see two table columns in wordpress tables for time values. Examples: post_date post_date_gmt post_modified post_modified_gmt comment_date comment_date_gmt What is the reason behind storing ...
  • 109
1 vote
2 answers
2k 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, ...
  • 183
3 votes
1 answer
7k 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 ...
0 votes
1 answer
2k 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(){...
  • 13
0 votes
1 answer
67 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. ...
  • 255
10 votes
1 answer
19k 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() ...
  • 113
0 votes
1 answer
1k views

Calculate how much time passed comparing WordPress comment and current time

I'm building a WordPress plugin. I need to show time like Twitter - how much time ago the comment was made etc. Is there a way doing this? Suppose someone comments 1 hour ago should be visible 1 hour ...
4 votes
3 answers
2k 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 ...
  • 621