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

The tag has no usage guidance.

0
votes
1answer
21 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
13 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
12 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
19 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
31 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
39 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
26 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
167 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
52 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
22 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
24 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
135 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
134 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
50 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
84 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
15 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
67 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
22 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
19 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
21 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
32 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
208 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
29 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
36 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
230 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
1k 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
239 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
276 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
84 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
227 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
33 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( '...
2
votes
1answer
482 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
27 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
27 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 ...
1
vote
1answer
27 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 ...
1
vote
0answers
25 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
0answers
23 views

Wordpress Server Time not changing/displaying correctly

I've diagnosed this as more a problem with the server than with wordpress itself (most likely) Basically, the day of the week is always tuesday, and the time is always 12:00 when I try to display it ...
0
votes
1answer
145 views

How to display Date and Time in Tamil Language?

Am working in a Tamil blog site.There I want to display date in Tamil language.(ie) செவ்வாய்க்கிழமை, மே 23, 2017 .I need to display like this in wordpress site.But I dont want to change all.Only the ...
0
votes
0answers
33 views

Help with time sensitive php function

I am trying to display a "Delete Post" link for front end users' posts using the following code. I can't get it to work and I don't understand PHP well enough to fix it. Any suggestions would be ...
0
votes
1answer
188 views

display last login date in the frontend

I am using this codes to add the column in the users listing page to show the last login by users. This codes are in my function file of my template: function insert_last_login( $login ) { global $...
-2
votes
2answers
71 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
1answer
267 views

Sort a custom post with ACF: Date Picker & Display Featured!

Hello I have a custom post type event and i have two custom fields: event_date event_type I want to display all my events which has event_type = Featured and sorting should be by event_date in DESC ...
0
votes
1answer
80 views

Shortcode function doesnt work without caption

I'm working on a site that has this function to output the caption of a picture and is credits/date but doesn't work if only credits/date are definied and caption isnt. If thats the case the function ...
0
votes
1answer
96 views

Display datetime in user's timezone

How do I get datetimes like publication time to be displayed in a user's given timezone? I haven't been able to find a plugin that works.
2
votes
2answers
744 views

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, ...
0
votes
1answer
843 views

get_the_date() for translating date format

I want to display a in Hindi like "jan 10" using get_the_date(). What i have tried : <?php echo get_the_date(_e('F j')); ?> output like : F jJanuary 10, 2017.
0
votes
1answer
21 views

Array sorting assistance

I have the following array that I want to sort, how would I approach this as it only has one key / column? Short brief: I have movies that are saved in a custom post type. some have time allocated ...