Cast(
Concat(
SubStr( [Prod_End], 0, 4), {2024}
SubStr( [Prod_End], 5, 1), {1}
SubStr( [Prod_End], 7, 2), {20}
),2)
This will output 2024120 to a analog calc tag, that i will use in reporting. (I need analog type because other tags are also analog; but thats not the point)
Problem:
You can see the picture that the formatting is not foolproof. This calculation will not work when days and hours are 2 digits.
My Question:
Does VT has this funcionality where I can:
convert this text type value of "2024-1-1 9-20:27:5" to a date type variable, so i can just do concat(year,month,day, hour, min)!
Similar to VBA which has CDate function to convert a text string to a date.
Otherwise, the above codeblock won't work unless the tag's PLC configuration changes to formatting(HH:mm:ss), it is what i am doing right now.
TIA
**What I am doing:
**![65ac93e4181c2](serve/attachment&path=65ac93e4181c2)
````
Cast(
Concat(
SubStr( [Prod_End], 0, 4), {2024}
SubStr( [Prod_End], 5, 1), {1}
SubStr( [Prod_End], 7, 2), {20}
),2)
````
This will output 2024**1**20 to a analog calc tag, that i will use in reporting. (I need analog type because other tags are also analog; but thats not the point)
**Problem:**
You can see the picture that the formatting is not foolproof. This calculation will not work when days and hours are 2 digits.
**My Question:**
Does VT has this funcionality where I can:
convert this text type value of "2024-1-1 9-20:27:5" to a date type variable, so i can just do concat(year,month,day, hour, min)!
_Similar to VBA_ which has _CDate_ function to convert a text string to a date.
Otherwise, the above codeblock won't work unless the tag's PLC configuration changes to formatting(HH:mm:ss), it is what i am doing right now.
TIA
edited Jan 22 at 9:13 am