# Expression tag, runScript

**URL:** <https://forum.inductiveautomation.com/t/expression-tag-runscript/10399>\
**Category:** Ignition\
**Created:** [August 26, 2015, 3:32pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/10399 "2015-08-26T15:32:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrea.montresor](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@andrea.montresor](https://forum.inductiveautomation.com/u/andrea.montresor)\
**Post date:** [August 26, 2015, 3:32pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/10399/1 "2015-08-26T15:32:04Z")

</div>

Hello,  
I tried to put this script in a “shared”, but I think that the path of the tag creates problems. it’s correct?

[code]def calcolaOra():

```
import system
import datetime
 	
year = system.tag.read("NBM_Tag/MINIEVO/EVENT/PIECE_DONE/PIECE_DONE_EVENT/END_PRODUCTION_YEAR")
year_1 = year.getValue()
month = system.tag.read("NBM_Tag/MINIEVO/EVENT/PIECE_DONE/PIECE_DONE_EVENT/END_PRODUCTION_MONTH").getValue()
day = system.tag.read("NBM_Tag/MINIEVO/EVENT/PIECE_DONE/PIECE_DONE_EVENT/END_PRODUCTION_DAY").getValue()
hour = system.tag.read("NBM_Tag/MINIEVO/EVENT/PIECE_DONE/PIECE_DONE_EVENT/END_PRODUCTION_HOUR").getValue()
minute = system.tag.read("NBM_Tag/MINIEVO/EVENT/PIECE_DONE/PIECE_DONE_EVENT/END_PRODUCTION_MINUTE").getValue()
second = system.tag.read("NBM_Tag/MINIEVO/EVENT/PIECE_DONE/PIECE_DONE_EVENT/END_PRODUCTION_SECOND").getValue()
if(1 <= month <= 12 and
		1 <= day <= 31 and
		0 <= hour <= 24 and
		0 <= minute < 60 and
		0 <= second < 60 and
		0 <= year <= 99):
	start_production = str(year)+'-'+str(month)+'-'+str(day)+' '+str(hour)+':'+str(minute)+':'+str(second)
	datetime_start_production = datetime.datetime.strptime(start_production, "%y-%m-%d %H:%M:%S")
	return datetime_start_production[/code]

```

How can I fix?  
How can I enter the date TESTDATETIME?

Thanks

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/f9cd717c34551dd3b0bb049b7e2ad6f28f1c13da.PNG)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [August 26, 2015, 3:52pm UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/10399/2 "2015-08-26T15:52:47Z")

</div>

You’re on the right track. You will need to specify which tag provider you are using.

---

<div class="post-metadata">

**Author:** ![andrea.montresor](https://avatars.discourse-cdn.com/v4/letter/a/5f9b8f/32.png) [@andrea.montresor](https://forum.inductiveautomation.com/u/andrea.montresor)\
**Post date:** [August 27, 2015, 6:33am UTC](https://forum.inductiveautomation.com/t/expression-tag-runscript/10399/3 "2015-08-27T06:33:14Z")

</div>

Thanks a lot!

Now it works.

Andrea
