Tell us what you are trying to do?
I am trying to store the current date and time in a date field.
I'm using the following shortcode to get the timestamp.
add_shortcode('wpv-post-today', 'today_shortcode');
function today_shortcode() {
return time();
}
I have been able to confirm this shortcode is generating the proper timestamp.
Here's how I'm saving the timestamp in the date field.
[cred_field scaffold_field_id='submission-date' field='submission-date' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-today]']
When I display the raw value of the submission-date field I see a different value than the timestamp that was generated by the shortcode. As an example. When the shortcode generated timestamp of 1635431592 the submission-date field stored a value of 1635379200 which is the same date but 12:00am instead of 2:33:12 PM.
I cannot figure out why it's not storing the correct timestamp.
Hello,
please try these:
1) Dashboard-> Toolset-> Custom fields, find and edit the custom field group, find and edit the custom field "submission-date", enable option "Input date and time"
2) Modify your custom PHP codes as below:
add_shortcode('wpv-post-today', 'today_shortcode');
function today_shortcode() {
return current_time('timestamp');
}
And test again