Read a date process parameter in a script task

What is the data type to read a date parameter in a script task ?

 

var myVar = Get<????>("MyParameter") 

 

Like 0

Like

3 comments
Best reply

You would use:

 

var myDate = Get<DateTime>("MyDateParam");

 

A date only param is still just a .NET DateTime struct just like a Date and Time value in Creatio -  A date only will just have a zero time value (so the value would be something like "Oct 29, 2020 00:00:00")

Ryan

You would use:

 

var myDate = Get<DateTime>("MyDateParam");

 

A date only param is still just a .NET DateTime struct just like a Date and Time value in Creatio -  A date only will just have a zero time value (so the value would be something like "Oct 29, 2020 00:00:00")

Ryan

Hi Ricardo,

 

Indeed, you can use the solution suggested above. However, please note that you'll get the date in a server timezone.

var myDate = Get<DateTime>("MyDateParam");

 

There is an option to pass a string as usual and parse it then. Also, you can pass ticks and use the result. For example: 

long ticks = Get<long>("MyDateParameterInTicks");

new DateTime(ticks, DateTimeKind.Utc).ToLocalTime();

 

Please read more about ticks property by the link below:

https://docs.microsoft.com/en-us/dotnet/api/system.datetime.ticks?view=…

 

Regards,

Anastasiia

Anastasiia Markina,

That is good to know, thanks Anastasiia.

Show all comments