Problem:
The issue here is that the user wanted to convert his date time from the database that was created using The Events Calendar plugin. The customer retrieved the value using [wpv-post-field name='_EventStartDateUTC']
Solution:
This was actually done by using a custom shortcode.
// Add Shortcode function change_date( $atts ) { // Attributes $atts = shortcode_atts( array( 'date' => '', 'format' => '', ), $atts ); $originalDate = $atts['date']; $newDate = date($atts['format'], strtotime($originalDate)); return $newDate; } add_shortcode( 'change_date', 'change_date' );
The shortcode above takes a date in any format and converts it to the desired format.
Example
[change_date date="[wpv-post-field name='_EventStartDateUTC']" format='Y-m-d H:i:s"']
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)
This topic contains 8 replies, has 2 voices.
Last updated by 6 years, 6 months ago.
Assisted by: Shane.