Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [date-time]

The tag has no usage guidance.

0
votes
1answer
9 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
13 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
45 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
8 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
14 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
16 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
19 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
36 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
21 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
33 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
26 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
37 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
53 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
17 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
21 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 ...
0
votes
0answers
73 views

How to get the correct date depending on the current visitor timezone?

I want to change the date format for my custom post types from dates to time. So i starting using this code: echo get_post_time('g:i A', TRUE, get_the_ID(), TRUE ); It's working successfully but ...
1
vote
2answers
72 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
178 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
178 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
70 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
29 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
0answers
65 views

How to bulk change posting date?

I have a custom post type (photograph). Due to bulk approval there are many that have the same date. This of course messes up the sort and navigation (prev/next post) system. How would I change the ...
0
votes
1answer
254 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
266 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
211 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
171 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 ?
0
votes
0answers
107 views

Convert WordPress calendar from Gregorian to Lunar

I'm developing a website that sells products based on Lunar calendar using Woocommerce and Woocommerce subscription. Problem 1: Subscribers are supposed to pay on the first day of every month of ...
1
vote
1answer
23 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
22 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
26 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
37 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
362 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
64 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
27 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
37 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
290 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
2k 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
292 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 ...
3
votes
1answer
360 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
126 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
345 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
55 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
711 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
33 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 ...
0
votes
1answer
33 views

How to setup language of a date in a plugin

I am working on a Wordpress theme using a template to manage sports team, matches, players, etc. I settled my local wordpress time in French. In the blog part, no problem the post are displaying date ...
2
votes
1answer
35 views

If else statement based on date_diff value

I have a problem with dates. I need to add if-else logic to show different content. It's based on date_diff values. And here's go a problem: I need to show button if today's date - post_modified ...