Skip Navigation

[Resolved] Event date in views showing one day earlier

This support ticket is created 3 years, 9 months ago. 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.

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)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by digitalF 3 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1654159

I've got a feed on a homepage using views that displays the event title/date - however the date displayed is showing one day earlier that it actually is, any idea why this could be happening?

#1654161

I'm happy to send the site URL/logins privately is this will help.

#1654399

Shane
Supporter

Languages: English (English )

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

Hello,

Thank you for getting in touch.

Yes please allow me to have admin access to the website as well as a link to the page where I can have a look at the issue.

Thanks,
Shane

#1655835

Shane
Supporter

Languages: English (English )

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

Hello,

Not sure what I can do about this as the issue is being caused by this shortcode here.
[tribe_formatted_event_date format="jS F" timezone="Europe/London"]

I would recommend contacting the The Events Calendar team in order to get this resolved. Even adding the shortcode itself to the page in the link below also produces the wrong date.

hidden link

Thanks,
Shane

#1656297
Screen Shot 2020-06-09 at 22.07.36.png

Hi Shane,

If there is a workaround to not display the 'tribe_formatted_event_date' code I'm more than happy to work with that. I currently have the ordering of the of the events by the start date (see attached screenshot).

So if there is anything you can give me to add to display the date in (jS F) format - i.e 20th March - that would be great.

Many thanks.

#1657199

Shane
Supporter

Languages: English (English )

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

Hello,

I've created a custom shortcode to format the date for you after getting the raw date information from the database.

Here is the shortcode below.

// Add Shortcode
function cust_format_date( $atts ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'date' => '',
			'format' => '',
		),
		$atts
	);

	// Creating timestamp from given date
	$timestamp = strtotime($atts['date']);
	 
	// Creating new date format from that timestamp
	$new_date = date($atts['format'], $timestamp);
	
	return $new_date;

}
add_shortcode( 'cust_format_date', 'cust_format_date' );

The shortcode that is generate is [cust_format_date date="" format="jS F"] . I retrieved the date raw information from the database using this shortcode here [wpv-post-field name='_EventStartDate'] which is a shortcode created by Types.

Finally I've added this to your view.
[cust_format_date date="[wpv-post-field name='_EventStartDate']" format="jS F"]

Please let me know if your dates are now displaying correctly.

Thanks,
Shane

#1662959

Hi Shane,

That's spot on! Thank you so much for your help, much appreciated!

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