Questions tagged [date-time]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
73 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 ...
0
votes
0answers
23 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'. ...
0
votes
1answer
15 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 ...
0
votes
0answers
29 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 ...
0
votes
0answers
42 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 ...
0
votes
0answers
17 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 ...
0
votes
0answers
21 views

Show content between ACF fields for start and end time

I've been trying to work out how to implement an acf timepicker field into my php. The idea is, if the current time falls between my selected start and end times then a certain piece of content will ...
1
vote
0answers
71 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 ...
0
votes
2answers
56 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 ...
2
votes
1answer
45 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 ...
0
votes
0answers
16 views

How can I get the time remaining for an event to appear in few months time

I am looking forward to embedding countdown dates in my wordpress post editor via wp shortcodes. I am not so good in coding, so i have come across already written codes but they require me to input ...
0
votes
1answer
188 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 ...
0
votes
0answers
55 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 ...
1
vote
0answers
229 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 ...
0
votes
1answer
198 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: ...
0
votes
1answer
159 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 ...
0
votes
2answers
112 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. ...
1
vote
0answers
239 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 ...
0
votes
1answer
103 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'=&...
0
votes
2answers
498 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 ...
1
vote
1answer
100 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. ...
0
votes
1answer
34 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 ...
0
votes
2answers
224 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?
1
vote
0answers
65 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 ...
0
votes
0answers
74 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 ...
0
votes
0answers
126 views

Compare ACF Date field to today or yesterday

This is a very simple question, but for some reason having challenges with it. I have set up ACF field group. I wanted to compare a "date field" to the current "today's date" and "yesterdays" date. ...
0
votes
1answer
148 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 :...
0
votes
1answer
27 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-&...
0
votes
1answer
116 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 ...
0
votes
1answer
91 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 ...
1
vote
1answer
1k 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) ?>"><?...
0
votes
1answer
170 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 ...
0
votes
1answer
347 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. $...
2
votes
1answer
631 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
1k 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
1answer
72 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
327 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
126 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
2k 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
16 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
21 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
10 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
26 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
59 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
59 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
78 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
941 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
148 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)...
2
votes
1answer
3k 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
631 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
2 3 4 5 6