Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Lyne Berro

Exporting date published shows time

How can i not have the time shown when exporting the date published field? as pictured here

https://i.imgur.com/u7Insy8.png

1 month ago
Stefan
Developer

We decided to export the date format that is returned by the Post in WordPress.
If you want to change this for export, you can use the hook ac/export/value.
The snippet will look something like this:

add_filter( 'ac/export/value',function( $value, AC\Column $column, $id ) {
	if( $column instanceof \ACP\Column\Post\DatePublished ){
		$value = get_the_date( 'Y-m-d', $id );
	}

	return $value;
}, 10, 3 );
1 month ago
Tobias
Developer

When exporting a ACF Date field type you should get the correct date. ACF does not store the time. Maybe you have used the Date Time field instead of a Date field. Could you check this?

1 month ago
Stefan
Developer

Did you try the snippet I send you earlier?
It is good to know that our export feature does indeed not export the way you have setup your column.
The date published column is always exported as the WP_Post returns the date.
The ACF Date column should always export in ‘Y-m-d’.

The snippet above will remove the time from the date in your export for the ‘Date Published’ column. I don’t understand why the ACF date is not correct in your Excell sheet. Just to be sure, can you check the raw CSV file and see if the date is also in the wrong format? Maybe the date is being corrected when opening the file in Excel.

And do you not have any custom hooks in your website related to our export feature?

1 month ago

You must be logged in to reply to this topic.