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
0answers
13 views

How to convert the data-time-picker field type in ACF to user's browser timezone using MomentJS?

https://www.advancedcustomfields.com/resources/date-time-picker/ What is the best approach for changing the output of the Advanced Custom Field option for date-time-picker field type, with a timezone ...
0
votes
0answers
12 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
16 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
34 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
18 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
16 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
22 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
30 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
19 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
14 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
20 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
41 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
52 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
55 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
173 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
59 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
26 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
47 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
190 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
197 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
92 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
124 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
89 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
20 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
24 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
34 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
278 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
43 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
256 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
267 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
310 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
107 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
271 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
39 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
582 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
31 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
32 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
29 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
26 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
24 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
154 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
34 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
205 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 $...