Skip Navigation

[Résolu] How to calculate end date, when having a start date and amount of days

This support ticket is created Il y a 2 années et 3 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

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

Last updated by fred-r.M Il y a 2 années et 3 mois.

Assisted by: Minesh.

Auteur
Publications
#2259949
2022-01-06_15-32-23.jpg

Dear Minesh

This I do have like this, but on this link: hidden link

On the first column, the 4th line, it's still Mrz. This is because I do have there the Toolset short code for this filed I use.

It's the "start date of any tour. So any other custom short code I can't use there, or I just do a new custom code.

Do You understand what I am talking about? In this first column, I do use the Toolset short code, and this gives me an Mrz - and not a Mär.

Regards,

#2259965

Minesh
Supporter

Languages: Anglais (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've replaced the existing shortcode:

[types field='tour-date-field' style='text' format='d. M Y'][/types]

With:

[tourenddate tourdate='[types field='tour-date-field' style='text' format='Y-m-d'][/types]' type="date"]

I can see now it shows month name as: Mär
=> hidden link

#2259997

Dear Minesh

But this short code don't gives the start date out!

I might need to add another custom function with a short code short code.

I added now another function, where it shows me now the start date:

function custom_tourstart_date( $atts ) {
    $adate = '';
	$atype = '';
	// Attributes
	$atts = shortcode_atts(
		array(
			'tourdate' => 'today',
			'type' => '',
		),
		$atts
	);
  
    $adate = $atts['tourdate'];
    $atype = $atts['type'];
    
    if ((ICL_LANGUAGE_CODE=='en') && ($atype=='day')) {
	$startdate = date('l', strtotime($adate));
	}
	else if ((ICL_LANGUAGE_CODE=='en') && ($atype=='date')) {
	$startdate = date('d. M Y', strtotime($adate));
	}
	else if ((ICL_LANGUAGE_CODE=='de') && ($atype=='day')) {
      setlocale(LC_ALL, 'de_DE.UTF-8'); 
      $startdate = strftime('%A', strtotime($adate)); 
    }
	else if ((ICL_LANGUAGE_CODE=='de') && ($atype=='date')) {
    
      setlocale(LC_TIME, 'de_DE.UTF-8'); 
      
      $startdate = strftime('%e. %b %Y', strtotime($adate)); 
      $startdate = str_replace("Mrz","Mär",$startdate); 
    }
	
	return $startdate;
}
add_shortcode( 'tourstartdate', 'custom_tourstart_date' );

Regards,

#2260025

My issue is resolved now. Thank you!

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