Hi @pauhana,
You can change the date format in plugin settings. Just scroll down on tab plugin until you find the date format setting.
Does this help?
Peter
Still unclear.
Here is a screenshot of my current settings for dates:
https://ibb.co/GnmbXsg
My date has been confirmed correct, but shows up within the Data Explorer as
“November 30, -0001 12:00 am”. Given the date output setting, I was expecting
“April 11, 2022”.
Where am I going wrong?
Thanks for the help!
Sorry, wrong graphic.
Date format output (WordPress format) is given as “F j, Y”.
Hi @pauhana,
How do you store the timestamp? Can you share the code?
What output do you get from a stand query in the Query Builder?
Thanks,
Peter
Here’s a snippet of my code:
$today = strtotime('today PST');
if ($today !== false) {
//DBG $page_text .= 'Today is [' . date("Y-m-d", $today) . ']</br>';
$db_columns = array('svs_seed_order_date' => $today,
'svs_seed_order_member_id' => $user_id,
'svs_seed_order_set_id' => $new_seed_set_id);
$wpdb->insert('svs_seed_order', $db_columns, array('%d', '%d','%d'));
} else {
$msg = "Internal error: Problem determining today's date.";
}
As I say, the value stored has been confirmed to be fine.
Please let me know if there is a better way to go about storing the date…
Oh, and as to your second question, the query builder shows the date values to be zeroed out; the date column shows as “0000-00-00 00:00:00”.
Hi @pauhana,
I think your code snippet is the problem. The strtotime return an int which MySQL interprets as a wrong format, resulting in a datetime with all zeros. With wpdb->insert it’s better to use current_time:
https://developer.ww.wp.xz.cn/reference/functions/current_time/
Does this solve the issue?
Thanks,
Peter
Thank you Peter.
I ended up having so much trouble trying to get a date interpreted properly, I ended up just storing it as a string. Not optimal, but good enough.
Thanks again for the help.
Hi @pauhana,
Not sure if this is applicable to your situation, but the simplest solution to get rid of these manual actions is to let your DBMS do this for you:
alter table svs_seed_order modify svs_seed_order_date datetime default current_timestamp on update current_timestamp
When you remove column svs_seed_order_date from all your insert and update statements your DBMS will keep it up to data for you.
Hope this helps,
Peter