Skip Navigation

[Gelöst] How to calculate end date, when having a start date and amount of days

This support ticket is created vor 2 Jahren, 11 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 18 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von fred-r.M vor 2 Jahren, 10 Monaten.

Assistiert von: Minesh.

Author
Artikel
#2259949
2022-01-06_15-32-23.jpg

Dear Minesh

This I do have like this, but on this link: versteckter 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

Sprachen: Englisch (English )

Zeitzone: 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
=> versteckter 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!