Questions tagged [date-time]

The tag has no usage guidance.

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

How to remove the hyperlink from all post dates where when you mouseover over the post date, a hyperlink displays like- “…com/2023/08/“

How can the “date” hyperlink be disabled? I want to keep the date text in posts (archive and single posts), without it linking anywhere.
Jef Gunion's user avatar
0 votes
1 answer
30 views

Different date time in results of search

In my search.php file i have a loop which succesfuly gives list of search query. global $wp_query; $total_results = $wp_query->posts; if ( $total_results ) : foreach ( $...
X9DESIGN's user avatar
  • 159
0 votes
1 answer
53 views

How to assign to each output values from foreach loop to a meta_key?

For a custom plugin with add start and end date of event/post, I must generate several datetime with the same meta key to compare the period of event with the period of weeks. I my case I'm obliged to ...
imagIne's user avatar
  • 53
0 votes
1 answer
44 views

What might cause two dates to appear on a blog post?

I'm the webmaster of a grad school student group. We have a WP site I took over from the last webmaster, who took over from the person before, etc. I just started over the summer. Blog posts are ...
Erica's user avatar
  • 1
0 votes
1 answer
229 views

WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)

I would use together meta_query and date_query but it seems it's not possible . What I'm looking to do : (display next 12 month from current month) : for each April 2023 If date range event (start ...
imagIne's user avatar
  • 53
0 votes
0 answers
6 views

date_query returning only the most recent post instead of the post published before today

Here is the code, I am using <?php $today = get_the_date('F j'); $args = array( 'post_type' => 'on-this-day', 'posts_per_page' => 1, 'post_parent' => 0, 'post_status' => 'publish', ...
Fahim Anwer's user avatar
0 votes
4 answers
42 views

How to customize Date Format for American visitors?

Basically, I just want the format to be mdY if an American / US Resident is using the site, and dmY for everyone else. Right now, the only way I see I can do this is changing it via radio buttons. Is ...
QRIOS WORLD's user avatar
0 votes
1 answer
665 views

Convert custom field date format to "Wordpress default"

Hello ladies and gents, I'm using F j, Y (e.g. December 28, 2022) as default date format on my site (set in the admin settings). I have an event custom post type with an event_start_date custom field. ...
nomade0's user avatar
  • 27
0 votes
1 answer
133 views

Bulk Updating Post Date in 1 day Increments

I have 1700 Motivational Updates + Write ups imported to WordPress. The problem is they are all published on the same date. I'd ideally like for them to be published once per day. I researched a lot ...
user1595112's user avatar
0 votes
0 answers
238 views

wordpress built-in Jalali date convertor

I'm developing a new plugin for a client and he wants dates to be in Jalali. As I changed language of WordPress to Persian, the posts date automatically changed to Jalali. So I Think maybe WordPress ...
Mohsen35's user avatar
  • 101
2 votes
1 answer
134 views

Convert GMT time to local time in Gutenberg Block Editor

I'm wondering if I can use any of the functions listed in the @wordpress/date package to convert a GMT date to a date in the user's locale. For example, this GMT datetime 2023-06-20 17:46:00 would be ...
David M's user avatar
  • 23
1 vote
0 answers
30 views

How can I create 'future' and 'past' parameter for restAPI by filtering the CPT custom date field by greater than / less than current datetime?

add_filter( 'rest_events_query', 'filter_events_by_date_field', 999, 2 ); function filter_events_by_date_field( $args, $request ) { if ( ! isset( $request['filter_date'] ) ) { return $args; } $...
Abi's user avatar
  • 11
0 votes
1 answer
249 views

Separating publish date and last modified

Am I correct in understanding that the publish date and the modified date are actually the same thing under the covers in WP? We have a need to show “this article was last updated on”, which could be ...
Khom Nazid's user avatar
0 votes
1 answer
51 views

Change letters for day name

When I use this code the name of the day been writed with a small letter. get_the_time(strtotime($DateValue)), get_the_time('l d.m.Y H:i', $post) I want the name of the day looking like this: ...
bjovaar's user avatar
  • 21
1 vote
1 answer
36 views

How to render a time-of-day string like '16:42' with a site's chosen time format?

I have a need to display a time-of-day value in a site's chosen time format. For example I have 16:42:18 and want to display it as 4:42 PM if the time_format option is g:i A, or 16:42:18 if the ...
O. Jones's user avatar
  • 471
0 votes
1 answer
101 views

WP function won't work on 404 template page

I made a custom template of error 404 page. In my header.php i use the_time() function to display current date. There is some problem with 404 page because the_time() function won't work, not return ...
X9DESIGN's user avatar
  • 159
0 votes
0 answers
27 views

Post Publish date not display on Umaya Child themes

I can't find out the option of published date or modified date on my blog post. I write the this code <?php echo get_the_date() ?> but can't display the date. this is my blog post where I try to ...
Nasim Amjad's user avatar
0 votes
1 answer
2k views

Why do I need to set my PHP timezone when it's already set in WordPress?

I have WordPress set to Los Angles time in Settings > General. In my database I have a DATETIME column. When I use $dt = DateTime::createFromFormat('Y-m-d H:i:s', $value_from_db); and then $dt->...
Gavin's user avatar
  • 384
0 votes
1 answer
470 views

If Post Published Date or Modified Date is 1 Year or Older, Display Notice on Post Page

I need a way to inform visitors if the post published date or modified date is older than 1 year and if so, display a message on the post page. I have added an code to my content-single.php file, but ...
Marcus Wood's user avatar
1 vote
0 answers
156 views

How to detect and handle the time difference between server and user in WordPress?

I have to make a custom plugin for a WordPress website. In this plugin, I have to create a meta box for a post where I have a time and date field that decides that when the post will be expired and ...
Muhammad Ibrar's user avatar
0 votes
1 answer
682 views

How to change the date and time in REST API for comments?

/** * Add a Formatted Date to the WordPress REST API JSON Post Object * */ add_action('rest_api_init', function() { register_rest_field( array('comment'), 'formatted_date', ...
Johan's user avatar
  • 309
0 votes
1 answer
2k 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 ...
Besart's user avatar
  • 101
0 votes
0 answers
32 views

How to set post date in post_type so that it's same as latest post in category

I have post_type called 'series' and posts with sharing category as attachment. The problem is when I create list using post_type by date, the date follows post_type post date and not latest 'post'. ...
Guruh's user avatar
  • 3
0 votes
1 answer
152 views

User set date and time from frontend doesn't get stored into database

My application lets users store diary entries into a database table. They are free to set the date and time to what they need using html inputs (so I can't simply use the current time because they ...
Antti's user avatar
  • 127
0 votes
0 answers
54 views

query hook parse_tax_query function takes no effect

I'm trying to build a function (inside a plugin), which limits the shown posts to the time a logged in user is registered in weeks. (So if a user is registered for 4 weeks the categories page shoud ...
bennyVen47's user avatar
0 votes
0 answers
70 views

Compare time value in WP_User_Query for sending emails

I am trying to setup a custom plugin that will compare the time (last activity of a user) and send emails to them. I am using the below WP_User_Query and a cron job function reminder_email() { // Get ...
Honoluluman's user avatar
0 votes
0 answers
37 views

WordPress Translate Date Function is giving Error

I have a function for translating wordpress date and numbers etc. I am not sure what's wrong with this function. The function works perfectly but wordpress shows error on pages with custom fields ...
Jihan Ahmed's user avatar
1 vote
0 answers
214 views

Trash / Draft a WordPress custom post after custom date field expires

I have seen some examples of people asking similar to this but no real solution. Hopefully someone maybe able to point me in the right direction I have a Custom Post Type set up called ...
Adam's user avatar
  • 111
0 votes
2 answers
1k views

Check If Post Was Published More Than 6 Months Ago Using get_the_date

Inside my content-single template, I have a conditional check that displays text based on how old the post is. The idea is to inform visitors that they might be reading "old" news. Problem ...
Harold Aldersen's user avatar
2 votes
1 answer
61 views

How to get the latest posting time of archived pages in WordPress?

Is there a way to get the post time of the latest post under the WordPress archive page? I would like to add a feature to the archive page to show the latest time of posts published under that ...
Matthew's user avatar
  • 151
0 votes
1 answer
503 views

No more get_option('date_time') in Wordpress 5.5?

The template I'm using outputs the date of a post using: echo get_the_date( get_option( 'date_time' ) ); I was wondering why this output is now (after upgrade to WP 5.5) not working anymore? A fast ...
wittich's user avatar
  • 173
0 votes
0 answers
152 views

Wordpress wrong dates bug

I am using Wordpress version 5.4. I have a problem with the dates in a CPT, and it is that the dates show one day less. Example: If I put in the backend the date, 08/18/20, in the frontend it shows me ...
Anderson Amador's user avatar
1 vote
0 answers
468 views

Changing wordpress publication date to ACF date and time picker date not working

This might be a long post but I want to explain in detail what I'm trying to do and what I've already done. I'm making custom forms using the advanced custom fields plugin and I need to display these ...
pops0903's user avatar
0 votes
1 answer
618 views

Find hours between post_date and post_date_gmt

I'd like to find the time difference -preferably in hours- between post_date and post_date_gmt. I tried $age = date_diff(get_post_time(),get_post_time($gmt = true)); but this returns Warning: ...
RubenGeert's user avatar
0 votes
1 answer
689 views

Apply filters on date format

I use a Wordpress Theme where the format date and time is directly coded in 2 formats : <?php the_time('d M'); ?> <?php the_time('H:i'); ?> What I want : Display the date and the time ...
Pierre L.'s user avatar
0 votes
2 answers
193 views

Display time as "12:00 noon" instead of "12:00 pm"

We display event dates/times via Wordpress date and time functions in am/pm time (12 hour, not 24 hour). For any times that are noon - i.e. "12:00 pm" - we'd like to display "12:00 noon" instead. ...
Jules's user avatar
  • 83
1 vote
0 answers
519 views

Trying to change database tables storage engine to innodb gives error "invalid default value for 'post_date'"

I have a live WordPress website. Most of the tables are using MyISAM storage engine with UTF-8 encoding. I need to switch their storage engine to innodb. But when I try to change the engine, I get ...
Abozanona's user avatar
  • 139
0 votes
1 answer
347 views

List taxonomy terms plus their latest post ordered by post date

I have the following code: $custom_terms = get_terms('columna'); foreach($custom_terms as $custom_term) { wp_reset_query(); $args = array('post_type' => 'post', 'posts_per_page'=&...
Joaquín Navarro's user avatar
0 votes
2 answers
2k views

Recoverable Fatal Error - Object of class WP_Post could not be converted to string

Im using ACF and trying to show a post type title based on the current time. So I have my post type entry with start_time and end_time and my conditional is showing my div.onAir, but Im getting this ...
EdgarAlexPoe's user avatar
1 vote
1 answer
275 views

What are the "U" and "G" time formats?

In WordPress time functions, such as get_post_time(), one can pass a couple of formats that I do not understand what they do. Those are U and G. What are those exactly? Documentation is pretty vague. ...
Greeso's user avatar
  • 2,166
0 votes
1 answer
46 views

How do I check or test a WordPress Auto Year Change Script?

How can you test a WordPress copyright year that is generated dynamically or through PHP, meaning when the year changes without waiting an entire year to see if it changes? I do not know anything ...
Marc Striebeck's user avatar
0 votes
2 answers
1k views

get_the_date() returns english Year & Day when language is Arabic

I changed my WordPress language to Arabic, Now get_the_date() returns يناير 30, 2020 (half Arabic & half english) but I need to get date full Arabic like: يناير ٣٠, ٢٠٢٠ How can I do this?
Delowar Hosain's user avatar
1 vote
0 answers
119 views

CMB2 toolkit: Compare 2 Dates and validate the Time

Hello i am using the CMB2-toolkit for Wordpress: https://github.com/CMB2/CMB2/wiki/Field-Types I have a Problem where i have 2 Datetimes, where one is the Starting-Time and the other is the Ending ...
Question221019's user avatar
0 votes
0 answers
131 views

Serve visitor post time adjusted to their timezone

I want post times to reflect the timezone of the logged in or logged out user on my site. So if I post at 2:43PM London time, I want a user or visitor from Tokyo to see the post time as 11:43PM I'm ...
Leopold's user avatar
0 votes
1 answer
189 views

How to fix mysql2date() for 5.3.2 version?

When I upgrade Wordpress into 5.3.2 version, a date on a PDF invoice generated by a plugin disapeared. The function mysql2date() which makes the date is a wp function and used in the plugin like this :...
J.BizMai's user avatar
  • 850
0 votes
1 answer
153 views

Can't convert ACF datepicker value to DateTime oject - gives me a boolean

I keep getting this error Call to a member function modify() on boolean with this code $date_value = the_sub_field( 'date_string' ); $date = DateTime::createFromFormat('d/m/Y', $date_value); $date-&...
ivan marchenko's user avatar
0 votes
1 answer
280 views

How can I fetch all the dates from custom fields from various different custom post types and show / list them at one place in ascending order?

I am using wordpress and pods for building a web app. I have created different custom post types like "project" , "task" and "material" and each of them have various different custom date fields. I ...
Graham Morteimer's user avatar
0 votes
1 answer
175 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 ...
cogorihaw's user avatar
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) ?>"><?...
user5447339's user avatar
0 votes
2 answers
379 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 ...
SpiritFly's user avatar

1
2 3 4 5
7