In Vijeo Designer, how do we record the date and time to a variable when a button is pressed?
Issue:
How to record a timestamp to a variable when a button is pressed?
Product Line:
Vijeo Designer (all versions)
Resolution:
To record the date and time when a button is pressed, you will need to create a script in that button that copies the system variables _Hours, _Minutes, _Seconds, _Year2, _Month, _Day to a string variable for time and a string variable for date.
Please see the example script below:
//-------------------------------------
//Script Created: Jan 25, 2016
//
// Description:
//
//-------------------------------------
// Replace this line with your script
String YearYY = _Year2.getStringValue();
String MonthMM = _Month.getStringValue();
String DayDD = _Day.getStringValue();
if(_Month.getIntValue() < 10)
{
MonthMM = "0" + _Month.getStringValue();
}
if(_Day.getIntValue() < 10)
{
DayDD = "0" + _Day.getStringValue();
}
DateString.write(YearYY + "/" + MonthMM + "/" + DayDD);
String HoursHH = _Hour.getStringValue();
String MinutesMM = _Minutes.getStringValue();
String SecondsSS = _Seconds.getStringValue();
if(_Seconds.getIntValue() < 10)
{
SecondsSS = "0" + _Seconds.getStringValue();
}
if(_Hour.getIntValue() > 11)
{
temp.write(_Hour.getIntValue() - 12);
HoursHH = temp.getStringValue();
TimeString.write(HoursHH + ":" + MinutesMM + ":" + SecondsSS + " pm");
}
else
{
TimeString.write(HoursHH + ":" + MinutesMM + ":" + SecondsSS + " am");
}
How to record a timestamp to a variable when a button is pressed?
Product Line:
Vijeo Designer (all versions)
Resolution:
To record the date and time when a button is pressed, you will need to create a script in that button that copies the system variables _Hours, _Minutes, _Seconds, _Year2, _Month, _Day to a string variable for time and a string variable for date.
Please see the example script below:
//-------------------------------------
//Script Created: Jan 25, 2016
//
// Description:
//
//-------------------------------------
// Replace this line with your script
String YearYY = _Year2.getStringValue();
String MonthMM = _Month.getStringValue();
String DayDD = _Day.getStringValue();
if(_Month.getIntValue() < 10)
{
MonthMM = "0" + _Month.getStringValue();
}
if(_Day.getIntValue() < 10)
{
DayDD = "0" + _Day.getStringValue();
}
DateString.write(YearYY + "/" + MonthMM + "/" + DayDD);
String HoursHH = _Hour.getStringValue();
String MinutesMM = _Minutes.getStringValue();
String SecondsSS = _Seconds.getStringValue();
if(_Seconds.getIntValue() < 10)
{
SecondsSS = "0" + _Seconds.getStringValue();
}
if(_Hour.getIntValue() > 11)
{
temp.write(_Hour.getIntValue() - 12);
HoursHH = temp.getStringValue();
TimeString.write(HoursHH + ":" + MinutesMM + ":" + SecondsSS + " pm");
}
else
{
TimeString.write(HoursHH + ":" + MinutesMM + ":" + SecondsSS + " am");
}
게시 대상: 슈나이더 일렉트릭 Korea


도움이 필요하신가요?
제품 선택기
애플리케이션에 적합한 제품과 액세서리를 빠르고 쉽게 찾을 수 있습니다.
견적 받기
영업 관련하여 온라인으로 문의하시면 전문가가 연락드립니다.
구매처
해당 지역의 가장 가까운 슈나이더 일렉트릭 대리점을 쉽게 찾을 수 있습니다.
지원 센터
한 곳에서 모든 요구 사항에 대한 지원 리소스를 찾아보십시오.