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