Questions tagged [date-time]

The tag has no usage guidance.

0
votes
1answer
24 views

Compare meta key to current date in pre get post

I'm looking for a way to compare a string to the current time. I found this question "pre_get_posts filter using numeric meta_query comparison (from dates)" and I'm confused as to get it to work. $...
0
votes
0answers
11 views

Generating list of dates with php, breaks when I add ACF to get the numbers [closed]

I'm trying to generate a list of billing dates based on user profile meta (with ACF). In the user's profile, you can set the day/month/year and number of payments that will be made, and on the ...
0
votes
1answer
6 views

Is a MySQL DATETIME or TIMESTAMP value retrieved through $wpdb in UTC?

I have a custom MySQL table with two columns that look like this: `timestamp_created` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, `datetime_created` DATETIME DEFAULT CURRENT_TIMESTAMP, When retrieving ...
0
votes
1answer
17 views

How to pull date/time in french format for wordpress post?

I am working on a wordpress post in which I want the date/time in frech format as shown below: ENGLISH By FJ Published April 9, 2019 at 4:05 p.m. Last updated April 9, 2019 at 4:14 p.m. FRENCH Un ...
0
votes
0answers
10 views

Incorrect display of bbpress forum topics & replies

not sure if this is the correct place to ask, but I'm scratching my head at this. We're making a demo wordpress site with a forum, and because the old site has a locked down forum, we can't export ...
0
votes
1answer
27 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-...
1
vote
2answers
23 views

Print last modified date only on posts

I'm printing the last modified date via functions.php with the following code function wpb_last_updated_date( $content ) { $u_time = get_the_time('U'); $u_modified_time = ...
-2
votes
1answer
327 views

Display Current Time using shortcode

I am using the below code to display current time in php supported time zones: <?php date_default_timezone_set('Asia/Kolkata'); $currentTime = date( 'd-m-Y h:i:s A', time () ); echo $currentTime; ...
1
vote
1answer
9 views

Set the publication date independent of the scheduled publication date

I want to write a post today (2019-01-15) I want to schedule the publication for the future (2020-09-03) I want the published date to reflect when it was originally written - so it appears as example....
0
votes
1answer
16 views

How do I make a page not visible at a certain time? [closed]

I have a product page and I wish to change the prices twice in a day automatically. I want it to repeat forever. So I have 2 options : schedule the page or the products. But I couldn’t find any plugin ...
0
votes
1answer
9 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
0
votes
0answers
18 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 ...
0
votes
1answer
23 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 ...
0
votes
1answer
42 views

How do you update post date (year only) in a separate custom field?

I would like to update all my posts with a custom field that stores the year the post was published. The "year" value will obviously be retrieved from the post's date meta data. I will then use the ...
0
votes
1answer
30 views

WP_CRON issue with UTC and local time

I have made a plugin to change some user metadata on a schedule according to the wp_cron function. If the current time is say between their lunch hours (that is in their user profile as date('g:i a', ...
0
votes
1answer
110 views

tribe_get_start_time displays the current date and time on other post types than tribe_events

i am displaying posts selected by an ACF relationship (with object format) on a page, including custom posts like tribe_events. I want to display the date and time on the tribe_events posts, but not ...
0
votes
1answer
28 views

3 different times on my Wordpress website

I have a wordpress website hosted at Hostgator (Brazil). The server shows the current correct time (in daylight saving time). In this example, the correct time is as below, ie 13h (America / São Paulo)...
0
votes
1answer
122 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
1answer
146 views

Render the published date/time formatted in ISO 8601 using Timber (.twig)

I am setting up Google Tag Manager's Data Layer and I have a .twig as my header file. I need to produce the date and time of the post in ISO 8601 format. "datePublished": "{{post.date}}" This ...
1
vote
0answers
36 views

UTC/local time in Worpdress

Problem is the one several post already has displayed : I've updated one of our wordpress from 4.6.1 to last version. Local time of server is not UTC and WordPress inside general options show a UTC ...
1
vote
0answers
23 views

Convert CST published date time to MST timezone

My WordPress install is using "Chicago" timezone as the general setting, would like to convert published date time to MST timezone in one of my sections (front-end display) Any suggestions? Thanks in ...
1
vote
2answers
145 views

Creating a function within functions.php to change the date

I'm using the PODS WordPress Framework which is amazing. I created a template with one of the fields publishing the date of an event which is done through a simple 'magic tag' like this {@...
2
votes
1answer
677 views

Use meta_query to display events by date in custom field

I'm working on a template for a specific category archive of the custom post type event. I need to make a query that shows future and ongoing events, ordering by a date in custom field. $termName = ...
1
vote
0answers
14 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 ...
2
votes
1answer
195 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 ...
3
votes
2answers
157 views

How to get year, month and hour in Wordpress?

Here is the code which gives me only day and month. I want to show all: year, month, day, hour and minutes. How can I do this? print '<time class="entry-date updated" datetime="' . esc_attr( ...
1
vote
0answers
43 views

Make WordPress use timezone for email Date header

My WordPress installations send emails with the Date header specified in UTC: Date: Wed, 18 Jul 2018 15:18:50 +0000 I would prefer that the mail be sent with dates encoded in localtime, which is ...
0
votes
1answer
384 views

How to check for WordPress timezone type?

If you choose a city as a timezone it will save to the "timezone_string" option but if you choose a Manual Offset (UTC+1 for instance) it is saved to the "gmt_offset" option if you need the ...
0
votes
1answer
30 views

Displaying time & date problem

How to display the last time the site was updated(the last time either a post or a page was created/ modified/deleted) in the header of my WordPress site?
0
votes
1answer
450 views

Wordpress returns a wrong date

I am trying to get the todays date , day and time . Today is : 10th july 2018,tuesday and time is 3.23am For time the below code works fine: $wpplcurrenttime = current_time( 'g:i a', $gmt = 0 ); ...
1
vote
1answer
478 views

How to add 2 hours to the wordpress time formed with current_time(“mysql”, false)?

How to add 2 hours to the wordpress time which has already been formed using current_time("mysql", false)?
2
votes
1answer
224 views

How to remove current year from wp_get_archives

Does anyone know how to exclude the current year from $args = array( 'limit' => '', 'format' => 'html', 'before' => '', 'after' => '', '...
0
votes
1answer
16 views

Change the year of the whole site

I want to change the year of the whole site, temporarily, from 2018 to 2019. So the year of the_time() has to be 2019. There are no plugins which can do this... How can this be done ?
1
vote
1answer
28 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 ...
0
votes
1answer
27 views

How to amend time format of comments, using child-theme?

How to amend (override) the time format of the comments (of the posts and pages), not touching the wordpress initial installation? I use a child theme and if it is possible in any way to do it from ...
0
votes
1answer
34 views

Get the most recently modified post date of most recently modified post

I have Googled this, but there are always answers to get the modified date of a single post, which I know how to do. What I'd like to do is get and display the most recent modified date of the most ...
2
votes
1answer
39 views

Get last seen date/time in wordpress get_comments() [closed]

I could get comment_date with a loop. And it shows like 2018-03-19 12:30:06. Here, I just want to get Last seen format. (For instance, 3 min ago , 1 hour ago , 1 day ago , 2 week ago ) How can I ...
-2
votes
1answer
513 views

How do I convert a custom field to a php date format? [closed]

I have a custom field with an example value of 2018/02/28 16:21. How do I convert that to 28th February 2018 at 16:21
0
votes
1answer
128 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
29 views

Compare date fails when date is in next year [closed]

I'm using a conditional statement to compare the current date with a date of a custom post type. I'm using ACF for the date field of the custom post. The statement works fine if the date of the event ...
0
votes
1answer
42 views

Query posts using less than

I have a working query using pre_get_posts that queries posts using the status post format that only shows those posts if it's in a date range using the UNIX time stamp. Only problem is that the post ...
0
votes
1answer
336 views

Woocomerce pulling wrong time from server -5 hrs difference

I wonder could anyone help me with the time zones. In my wordpress i have the time zone set for New York, When i make a booking on my wordpress the booking is added to woocommerce cart and the time is ...
0
votes
1answer
3k views

ACF datepicker meta_query Compare Dates in m/d/Y g:i a - Not in Ymd Format

I'm looking for a way to use meta_query to filter out posts with a meta-key value of a date-time in m/d/Y g:i a format. The post-meta is being set by ACF (Advanced Custom Fields). I want to ...
0
votes
1answer
330 views

Ordering / grouping posts by datepicker ACF

I'm currently ordering a bunch of events based on a datepicker from ACF. They are all grouped per month, so all events of October are all listed together, than November, December and on. I only have ...
2
votes
1answer
485 views

change the comment time output to: X time ago instead of actual date and time

<?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?> Above is the default code that exists for comments.php in the WP Core. This will produce an Output like this: ...
0
votes
1answer
191 views

Displaying the Month and Year that a page was Created?

Question How can I display only the Month and Year that a page was created? Background I have a page that will get changes has a field that shows the month and year. It needs to be in Month and ...
0
votes
2answers
475 views

Display published time for today's posts only

I'm building a blog theme. I know that the_date() and date() functions display published date of posts. And I know how to get posts' published time with the_time() function. I want today's posts to ...
0
votes
0answers
90 views

Force WP_Query to work in a local timezone [duplicate]

I have a template that displays an actual event if we have a today one, or a next future one. The template uses this WP_Query, that compares events date with the actual date: $args = array( '...
3
votes
1answer
969 views

human_time_diff() returns “48 years ago” for all comments

Trying to make a custom comments box. When I go to display the time when the comment was post (ie, 2 days ago, 3 hours ago, etc.) I get the same for every comment on every post: "48 Years" $args = ...
1
vote
1answer
39 views

Automatically Updating Publish Date Bug

I recently added a function to reset the publish date when a user updates a page. The code is as follows, thanks to @s_ha_dum for it because it works great except for one annoying instance. function ...