Hi Jan,
Is it an actual date field, or do you want to format the created date? Because that is a meta field.
Wowow quick reply! Thank you!
It’s two actual date fields. We are asking for date of birth and when someone can start a new job.
We also have dates in text fields that we pass through parameters. They are also formatted as m.d.Y. If there’s a way to also format them to Y-m-d that would be great.
HI Jan, there seems to be a bug in the plugin. I’ll remedy that. You actually should return something like “ymd_dash” if you want Y-m-d. The dash refers to the separator. Could also be dot. If nothing is added, like ymd it will add / as a separator.
Best thing you can do at the moment is to the use gfexcel_field_value_date and acutally parse the date how it comes in, and turn it into what you want.
something like:
add_filter('gfexcel_field_value_date', function ($date) {
try {
return \DateTime::createFromFormat('d.m.Y', $date)->format('Y-m-d');
} catch (\Exception $e) {
return $date; // keep original if something goes wrong.
}
});
I’ll see if I can fix the intended behavior later today.
You can use the same code for the other fields if you know the type and id. So something like: gfexcel_field_value_text_3_13 for a text field on form 3 with the id of 13.
-
This reply was modified 5 years, 4 months ago by
Doeke Norg. Reason: Info for other fields
Amazing, thank you so much! 🙂