Skip Navigation

[Résolu] Date Format for User Custom Date Field

This support ticket is created Il y a 1 an et 9 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 réponses, has 2 voix.

Last updated by Shane Il y a 1 an et 9 mois.

Assisted by: Shane.

Auteur
Publications
#2420765

Tell us what you are trying to do?
I added a series of Custom Fields to collect more info when registering for classes.
One of the fields is a date field for Date of Birth.
It used to be a text field and I converted it to a date field with a date picker

The data is collected in the Database like this,
wpcf-child-1-date-of-birth2 26/08/2016

But when I view the Edit User Page
wp-admin/user-edit.php?user_id=XX
The meta field for Date of birth ignores the database value and shows today's date.

I reentered the correct date using the date picker and it is stored in the same manner.

An export of user data shows correctly,
and the Users own profile page shows the right value,

So this is just in the WordPress admin area when I view the user profile page.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#2420849

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for getting in touch.

Based on what I see the DOB format in the database would be incorrect.

What should be in the database is a timestamp rather than this text "wpcf-child-1-date-of-birth2 26/08/2016".

What I recommend here is to re save the date field by selecting the correct DOB using the datepicker and then checking to see if a timestamp is being saved to the database.

Thanks,
Shane

#2420853

As per the original post,
I reentered the correct date using the date picker and it is stored in the same manner.
its all good when entered in the form, stored in the db, exported on a spreadsheet and displayed in the Users Profile Page.
Just not in the WordPress admin area for Edit User.

Wierd

#2420855

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?

Please where applicable please provide me with a link to an example page where I can see the issue.

I've enabled the private fields for your next response.

Thanks,
Shane

#2420857

No I stand corrected
the date in the db now seems to have taken this format
wpcf-child-1-date-of-birth2
1472169600

#2420863

Hi Shane,

So this having been a text field originally, I have the issue of old dates in one format and the dates themselves in another.
I suspect the options are:
revert to a text field.
go back over every date entry and manually re-enter them. (not likely with hundreds of entries)
or is there another option available??

#2420875

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

The field value of "1472169600" is actually correct given that it is now a timestamp.

The only options you have are as you say to either revert the field to a single line field or to go over the records and manually update the values.

I would recommend the latter where you update the fields so they now hold a timestamp as this will help later if you want to filter your users by DOB or order them by their DOB

Thanks,
Shane

#2421493

Right - so I need to find a way to get the right format of each date stamp when exporting too.
As it stands now I'm getting a CSV with 1472169600 instead.

Perhaps that's a job for the WP All Import team? Or maybe you have some suggestions. on how to extract toolset timestamps to CSV?

#2421687

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

how to extract toolset timestamps to CSV?

Is it that you want the timestamps to be converted to human readable dates in the CSV ? I'm not 100% sure what you mean.

Please provide some clarity.
Thanks,
Shane

#2421699

Hi there

yes the customer regularly pulls an export of the Customers data and the Custom fields we added to users (Customers)

So now we get a
Name - Address - DOB
Bob - London - 1472169600

When we were hoping for
Name - Address - DOB
Bob - London - 18-06-2021

#2421705

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

In this case yes you will need to contact the WP All Imports team to see if they have a solution to parse the data when its being exported.
Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.