Hi,
I would need to create a date and time field. However, in the wizard I only see the option to select date. How can I proceed?
Regards
Hello,
You can follow our document to setup the custom date field, I have tried it in a fresh WP installation the latest version of Toolset plugins, it works fine.
See below test site:
Login URL: hidden link
Post field group with date field:
hidden link
More help:
https://toolset.com/course-lesson/creating-custom-fields/
Hi,
perfect. One last question, I value this field from one of my functions. In the backend/frontend I always see the wrong timezone. Do I need to vary any settings?
From function I value it like this
$date = current_time('timestamp');
update_post_meta($bookingID, 'wpcf-date-time', $date);
My timezone is Europe/Rome. In the backend/fronted I always see it with one hour less.
Regards
Can you reproduce the same problem in above test site?
I need a live website to test and debug
Hi,
the value of my date field is handled by a php function. Unfortunately, I cannot craere this function in your test.
Regards
The problem only exists in your website, and it is a custom PHP codes issue, can you copy/paste your custom PHP function here?
Hi Luo Yang,
This is the code
$date = current_time('timestamp', 0);
update_post_meta($post_ID, 'test-date-1', $date);
Regards
I have tried it in a fresh WP installation + the latest version of Toolset plugins, it works fine.
see below sandbox site:
Login URL: hidden link
1) Create a custom date field "date-time"
hidden link
2) Create a post and display above date field "date-time":
hidden link
3) Add the custom PHP codes you mentioned above into theme file "functions.php":
hidden link
line 69~71:
$bookingID = 34;
$date = current_time('timestamp');
update_post_meta($bookingID, 'wpcf-date-time', $date);
Test above post in frontend:
hidden link
It can display current date time correctly.
Can you reproduce the same problem in above test site?