property ICalendar.valuesToICalendar (Values as String, Type as PropertyTypeEnum) as String
Converts the values to a value of ICalendar format. For instance, valuesToICalendar("Duration=15.5",exPropertyTypeDuration) returns "P15DT12H", which indicates 15 days and 12 hours.

TypeDescription
Values as String A String expression that specifies the Parameter=Value[;Parameter=Value] that indicates the expression to be converted to iCalendar format
Type as PropertyTypeEnum A PropertyTypeEnum expression that indicates the type of the Value to be converted.
String A String expression that specifies the iCalendar format
The valuesToICalendar property converts the known parameter to iCalendar format. The valuesFromICalendar property returns values for known parameters of the giving expression ( available for exPropertyTypeDuration, exPropertyTypePeriod and exPropertyTypeRecur types as explained bellow ). The fromICalendar property converts the ICalendar value to a VARIANT expression. The toICalendar property is the reverse function, so it converts a VARIANT expression back to iCalendar format.

The valuesToICalendar property is available for following types:

The following samples show how you can add a property of duration type:

VBA (MS Access, Excell...)

Set ICalendar1 = CreateObject("Exontrol.ICalendar.1")
With ICalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add "Duration1",ICalendar1.toICalendar(2.5,6)
		With .Properties.Add("Duration2")
			.Value = 2.5
			.Type = 6
		End With
		.Properties.Add "Duration3",ICalendar1.valuesToICalendar("D=2;H=12",6)
	End With
	Debug.Print( .Save )
End With

VB6

Set ICalendar1 = CreateObject("Exontrol.ICalendar.1")
With ICalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add "Duration1",ICalendar1.toICalendar(2.5,exPropertyTypeDuration)
		With .Properties.Add("Duration2")
			.Value = 2.5
			.Type = exPropertyTypeDuration
		End With
		.Properties.Add "Duration3",ICalendar1.valuesToICalendar("D=2;H=12",exPropertyTypeDuration)
	End With
	Debug.Print( .Save )
End With

VB.NET

' Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project.
Exicalendar1 = New exontrol.EXICALENDARLib.exicalendar()
With Exicalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add("Duration1",Exicalendar1.get_toICalendar(2.5,exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration))
		With .Properties.Add("Duration2")
			.Value = 2.5
			.Type = exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration
		End With
		.Properties.Add("Duration3",Exicalendar1.get_valuesToICalendar("D=2;H=12",exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration))
	End With
	Debug.Print( .Save() )
End With

VB.NET for /COM

AxICalendar1 = CreateObject("Exontrol.ICalendar.1")
With AxICalendar1
	With .Content.Components.Add("VCALENDAR")
		.Properties.Add("Duration1",AxICalendar1.toICalendar(2.5,EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration))
		With .Properties.Add("Duration2")
			.Value = 2.5
			.Type = EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration
		End With
		.Properties.Add("Duration3",AxICalendar1.valuesToICalendar("D=2;H=12",EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration))
	End With
	Debug.Print( .Save() )
End With

C++

/*
	Includes the definition for CreateObject function like follows:

	#include <comdef.h>
	IUnknownPtr CreateObject( BSTR Object )
	{
		IUnknownPtr spResult;
		spResult.CreateInstance( Object );
		return spResult;
	};

*/
/*
	Copy and paste the following directives to your header file as
	it defines the namespace 'EXICALENDARLib' for the library: 'ICalendar 1.0 Type Library'

	#import <ExICalendar.dll>
	using namespace EXICALENDARLib;
*/
EXICALENDARLib::IICalendarPtr spICalendar1 = ::CreateObject(L"Exontrol.ICalendar.1");
EXICALENDARLib::IComponentPtr var_Component = spICalendar1->GetContent()->GetComponents()->Add(L"VCALENDAR");
	var_Component->GetProperties()->Add(L"Duration1",spICalendar1->GettoICalendar(double(2.5),EXICALENDARLib::exPropertyTypeDuration));
	EXICALENDARLib::IPropertyPtr var_Property = var_Component->GetProperties()->Add(L"Duration2",vtMissing);
		var_Property->PutValue(double(2.5));
		var_Property->PutType(EXICALENDARLib::exPropertyTypeDuration);
	var_Component->GetProperties()->Add(L"Duration3",spICalendar1->GetvaluesToICalendar(L"D=2;H=12",EXICALENDARLib::exPropertyTypeDuration));
OutputDebugStringW( spICalendar1->Save() );

C++ Builder

Exicalendarlib_tlb::IICalendarPtr ICalendar1 = Variant::CreateObject(L"Exontrol.ICalendar.1");
Exicalendarlib_tlb::IComponentPtr var_Component = ICalendar1->Content->Components->Add(L"VCALENDAR");
	var_Component->Properties->Add(L"Duration1",TVariant(ICalendar1->get_toICalendar(TVariant(2.5),Exicalendarlib_tlb::PropertyTypeEnum::exPropertyTypeDuration)));
	Exicalendarlib_tlb::IPropertyPtr var_Property = var_Component->Properties->Add(L"Duration2",TNoParam());
		var_Property->set_Value(TVariant(2.5));
		var_Property->Type = Exicalendarlib_tlb::PropertyTypeEnum::exPropertyTypeDuration;
	var_Component->Properties->Add(L"Duration3",TVariant(ICalendar1->get_valuesToICalendar(L"D=2;H=12",Exicalendarlib_tlb::PropertyTypeEnum::exPropertyTypeDuration)));
OutputDebugString( ICalendar1->Save() );

C#

// Add 'exontrol.exicalendar.dll(ExICalendar.dll)' reference to your project.
exontrol.EXICALENDARLib.exicalendar exicalendar1 = new exontrol.EXICALENDARLib.exicalendar();
exontrol.EXICALENDARLib.Component var_Component = exicalendar1.Content.Components.Add("VCALENDAR");
	var_Component.Properties.Add("Duration1",exicalendar1.get_toICalendar(2.5,exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration));
	exontrol.EXICALENDARLib.Property var_Property = var_Component.Properties.Add("Duration2",null);
		var_Property.Value = 2.5;
		var_Property.Type = exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration;
	var_Component.Properties.Add("Duration3",exicalendar1.get_valuesToICalendar("D=2;H=12",exontrol.EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration));
System.Diagnostics.Debug.Print( exicalendar1.Save() );

JScript/JavaScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT>

<SCRIPT LANGUAGE="JScript">
function Init()
{
	var var_Component = ICalendar1.Content.Components.Add("VCALENDAR");
		var_Component.Properties.Add("Duration1",ICalendar1.toICalendar(2.5,6));
		var var_Property = var_Component.Properties.Add("Duration2",null);
			var_Property.Value = 2.5;
			var_Property.Type = 6;
		var_Component.Properties.Add("Duration3",ICalendar1.valuesToICalendar("D=2;H=12",6));
	alert( ICalendar1.Save() );
}
</SCRIPT>
</BODY>

VBScript

<BODY onload="Init()">
<OBJECT CLASSID="clsid:D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6" id="ICalendar1"></OBJECT>

<SCRIPT LANGUAGE="VBScript">
Function Init()
	With ICalendar1
		With .Content.Components.Add("VCALENDAR")
			.Properties.Add "Duration1",ICalendar1.toICalendar(2.5,6)
			With .Properties.Add("Duration2")
				.Value = 2.5
				.Type = 6
			End With
			.Properties.Add "Duration3",ICalendar1.valuesToICalendar("D=2;H=12",6)
		End With
		alert( .Save )
	End With
End Function
</SCRIPT>
</BODY>

C# for /COM

EXICALENDARLib.ICalendar axICalendar1 = new EXICALENDARLib.ICalendar();
EXICALENDARLib.Component var_Component = axICalendar1.Content.Components.Add("VCALENDAR");
	var_Component.Properties.Add("Duration1",axICalendar1.get_toICalendar(2.5,EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration));
	EXICALENDARLib.Property var_Property = var_Component.Properties.Add("Duration2",null);
		var_Property.Value = 2.5;
		var_Property.Type = EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration;
	var_Component.Properties.Add("Duration3",axICalendar1.get_valuesToICalendar("D=2;H=12",EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration));
System.Diagnostics.Debug.Print( axICalendar1.Save() );

X++ (Dynamics Ax 2009)

public void init()
{
	COM com_Component,com_Properties,com_Property,com_exicalendar1;
	anytype exicalendar1,var_Component,var_Properties,var_Property;
	;

	super();

	// Add 'exicalendar.dll(ExICalendar.dll)' reference to your project.
	exicalendar1 = COM::createFromObject(new EXICALENDARLib.exicalendar()); com_exicalendar1 = exicalendar1;
	var_Component = COM::createFromObject(com_exicalendar1.Content().Components()).Add("VCALENDAR"); com_Component = var_Component;
		var_Properties = COM::createFromObject(com_Component.Properties()); com_Properties = var_Properties;
		com_Properties.Add("Duration1",COMVariant::createFromStr(com_exicalendar1.toICalendar(COMVariant::createFromReal(2.5),6/*exPropertyTypeDuration*/)));
		var_Properties = COM::createFromObject(com_Component.Properties()); com_Properties = var_Properties;
		var_Property = COM::createFromObject(com_Properties).Add("Duration2"); com_Property = var_Property;
			com_Property.Value(COMVariant::createFromReal(2.5));
			com_Property.Type(6/*exPropertyTypeDuration*/);
		var_Properties = COM::createFromObject(com_Component.Properties()); com_Properties = var_Properties;
		com_Properties.Add("Duration3",COMVariant::createFromStr(com_exicalendar1.valuesToICalendar("D=2;H=12",6/*exPropertyTypeDuration*/)));
	print( com_exicalendar1.Save() );
}

Delphi 8 (.NET only)

AxICalendar1 := (ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1')) as EXICALENDARLib.ICalendar);
with AxICalendar1 do
begin
	with Content.Components.Add('VCALENDAR') do
	begin
		Properties.Add('Duration1',TObject(AxICalendar1.toICalendar[TObject(2.5),EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration]));
		with Properties.Add('Duration2',Nil) do
		begin
			Value := TObject(2.5);
			Type := EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration;
		end;
		Properties.Add('Duration3',TObject(AxICalendar1.valuesToICalendar['D=2;H=12',EXICALENDARLib.PropertyTypeEnum.exPropertyTypeDuration]));
	end;
	OutputDebugString( Save() );
end

Delphi (standard)

ICalendar1 := (IUnknown(ComObj.CreateComObject(ComObj.ProgIDToClassID('Exontrol.ICalendar.1'))) as EXICALENDARLib_TLB.ICalendar);
with ICalendar1 do
begin
	with Content.Components.Add('VCALENDAR') do
	begin
		Properties.Add('Duration1',OleVariant(ICalendar1.toICalendar[OleVariant(2.5),EXICALENDARLib_TLB.exPropertyTypeDuration]));
		with Properties.Add('Duration2',Null) do
		begin
			Value := OleVariant(2.5);
			Type := EXICALENDARLib_TLB.exPropertyTypeDuration;
		end;
		Properties.Add('Duration3',OleVariant(ICalendar1.valuesToICalendar['D=2;H=12',EXICALENDARLib_TLB.exPropertyTypeDuration]));
	end;
	OutputDebugString( Save() );
end

VFP

thisform.ICalendar1 = CreateObject("Exontrol.ICalendar.1")
with thisform.ICalendar1
	with .Content.Components.Add("VCALENDAR")
		.Properties.Add("Duration1",thisform.ICalendar1.toICalendar(2.5,6))
		with .Properties.Add("Duration2")
			.Value = 2.5
			.Type = 6
		endwith
		.Properties.Add("Duration3",thisform.ICalendar1.valuesToICalendar("D=2;H=12",6))
	endwith
	DEBUGOUT( .Save )
endwith

dBASE Plus

local oICalendar,var_Component,var_Property

oICalendar = new OleAutoClient("Exontrol.ICalendar.1")

var_Component = oICalendar.Content.Components.Add("VCALENDAR")
	var_Component.Properties.Add("Duration1",oICalendar.toICalendar(2.5,6))
	var_Property = var_Component.Properties.Add("Duration2")
		var_Property.Value = 2.5
		var_Property.Type = 6
	var_Component.Properties.Add("Duration3",oICalendar.valuesToICalendar("D=2;H=12",6))
? oICalendar.Save() 

XBasic (Alpha Five)

Dim oICalendar as P
Dim var_Component as P
Dim var_Property as P

oICalendar = OLE.Create("Exontrol.ICalendar.1")

var_Component = oICalendar.Content.Components.Add("VCALENDAR")
	var_Component.Properties.Add("Duration1",oICalendar.toICalendar(2.5,6))
	var_Property = var_Component.Properties.Add("Duration2")
		var_Property.Value = 2.5
		var_Property.Type = 6
	var_Component.Properties.Add("Duration3",oICalendar.valuesToICalendar("D=2;H=12",6))
? oICalendar.Save() 

Visual Objects

local var_Component as IComponent
local var_Property as IProperty

oDCOCX_Exontrol1 := IICalendar{"Exontrol.ICalendar.1"}
var_Component := oDCOCX_Exontrol1:Content:Components:Add("VCALENDAR")
	var_Component:Properties:Add("Duration1",oDCOCX_Exontrol1:[toICalendar,2.5,exPropertyTypeDuration])
	var_Property := var_Component:Properties:Add("Duration2",nil)
		var_Property:Value := 2.5
		var_Property:Type := exPropertyTypeDuration
	var_Component:Properties:Add("Duration3",oDCOCX_Exontrol1:[valuesToICalendar,"D=2;H=12",exPropertyTypeDuration])
OutputDebugString(String2Psz( oDCOCX_Exontrol1:Save() ))

PowerBuilder

OleObject oICalendar,var_Component,var_Property

oICalendar = CREATE OLEObject
oICalendar.ConnectToNewObject("Exontrol.ICalendar.1")

var_Component = oICalendar.Content.Components.Add("VCALENDAR")
	var_Component.Properties.Add("Duration1",oICalendar.toICalendar(2.5,6))
	var_Property = var_Component.Properties.Add("Duration2")
		var_Property.Value = 2.5
		var_Property.Type = 6
	var_Component.Properties.Add("Duration3",oICalendar.valuesToICalendar("D=2;H=12",6))
MessageBox("Information",string( oICalendar.Save() ))

Visual DataFlex

Procedure OnCreate
	Forward Send OnCreate
	Variant oComICalendar1
	Get ComCreateObject "Exontrol.ICalendar.1" to oComICalendar1

	Variant voComponent
	Get ComContent to voComponent
	Handle hoComponent
	Get Create (RefClass(cComComponent)) to hoComponent
	Set pvComObject of hoComponent to voComponent
		Variant voComponents
		Get ComComponents of hoComponent to voComponents
		Handle hoComponents
		Get Create (RefClass(cComComponents)) to hoComponents
		Set pvComObject of hoComponents to voComponents
			Variant voComponent1
			Get ComAdd of hoComponents "VCALENDAR" to voComponent1
			Handle hoComponent1
			Get Create (RefClass(cComComponent)) to hoComponent1
			Set pvComObject of hoComponent1 to voComponent1
				Variant voProperties
				Get ComProperties of hoComponent1 to voProperties
				Handle hoProperties
				Get Create (RefClass(cComProperties)) to hoProperties
				Set pvComObject of hoProperties to voProperties
					Variant vValue
						Get ComtoICalendar 2.5 OLEexPropertyTypeDuration to vValue
					Get ComAdd of hoProperties "Duration1" vValue to Nothing
				Send Destroy to hoProperties
				Variant voProperties1
				Get ComProperties of hoComponent1 to voProperties1
				Handle hoProperties1
				Get Create (RefClass(cComProperties)) to hoProperties1
				Set pvComObject of hoProperties1 to voProperties1
					Variant voProperty
					Get ComAdd of hoProperties1 "Duration2" Nothing to voProperty
					Handle hoProperty
					Get Create (RefClass(cComProperty)) to hoProperty
					Set pvComObject of hoProperty to voProperty
						Set ComValue of hoProperty to 2.5
						Set ComType of hoProperty to OLEexPropertyTypeDuration
					Send Destroy to hoProperty
				Send Destroy to hoProperties1
				Variant voProperties2
				Get ComProperties of hoComponent1 to voProperties2
				Handle hoProperties2
				Get Create (RefClass(cComProperties)) to hoProperties2
				Set pvComObject of hoProperties2 to voProperties2
					Variant vValue1
						Get ComvaluesToICalendar "D=2;H=12" OLEexPropertyTypeDuration to vValue1
					Get ComAdd of hoProperties2 "Duration3" vValue1 to Nothing
				Send Destroy to hoProperties2
			Send Destroy to hoComponent1
		Send Destroy to hoComponents
	Send Destroy to hoComponent
	Showln (ComSave(Self))
End_Procedure

XBase++

#include "AppEvent.ch"
#include "ActiveX.ch"

PROCEDURE Main
 	LOCAL oForm
	LOCAL nEvent := 0, mp1 := NIL, mp2 := NIL, oXbp := NIL
	LOCAL oICalendar
	LOCAL oComponent
	LOCAL oProperty

	oForm := XbpDialog():new( AppDesktop() )
	oForm:drawingArea:clipChildren := .T.
	oForm:create( ,,{100,100}, {640,480},, .F. )
	oForm:close  := {|| PostAppEvent( xbeP_Quit )}

	oICalendar := XbpActiveXControl():new( oForm:drawingArea )
	oICalendar:CLSID  := "Exontrol.ICalendar.1" /*{D6C87100-38E2-4ABB-8AC2-4C0097AEE2D6}*/
	oICalendar:create(,, {10,60},{610,370} )

		oComponent := oICalendar:Content():Components():Add("VCALENDAR")
			oComponent:Properties():Add("Duration1",oICalendar:toICalendar(2.5,6/*exPropertyTypeDuration*/))
			oProperty := oComponent:Properties():Add("Duration2")
				oProperty:Value := 2.5
				oProperty:Type := 6/*exPropertyTypeDuration*/
			oComponent:Properties():Add("Duration3",oICalendar:valuesToICalendar("D=2;H=12",6/*exPropertyTypeDuration*/))
		DevOut( oICalendar:Save() )

	oForm:Show()
	DO WHILE nEvent != xbeP_Quit
		nEvent := AppEvent( @mp1, @mp2, @oXbp )
		oXbp:handleEvent( nEvent, mp1, mp2 )
	ENDDO 
RETURN