function YesterdayDate() { // Obtain the current date var CurrentDate = aqDateTime.Today();
// Convert the date/time value to a string and post it to the log Today = aqConvert["DateTimeToStr"](CurrentDate); Log["Message"]("Today is " + Today);
// Calculate the yesterday’s date, convert the returned date to a string and post this string to the log YesterdayDate = aqDateTime["AddDays"](CurrentDate, -1); ConvertedYesterdayDate = aqConvert["DateTimeToStr"](YesterdayDate); Log["Message"]("Yesterday was " + ConvertedYesterdayDate); }
Let me know if this is not what you are trying to do or if you have questions.
The end goal is that I have a keyboard form in which
ineed to press the numbers accordingly the yesterday date and today date:
From:
To:
The full script that I wrote for it to work:
//USEUNIT KeypadNumbers
function SeniorCashierCoordinatesDateClick() { var DateYesterday = (aqConvert["DateTimeToFormatStr"](aqDateTime["Today"](), "%Y%m%d") -1); var DateToday = (aqConvert["DateTimeToFormatStr"](aqDateTime["Today"](), "%Y%m%d"));
Log["Message"]("Date inputed: " + (aqConvert["DateTimeToFormatStr"](aqDateTime["Today"](), "%Y%m%d") -1)); for (var i = 0; i < aqString["GetLength"](DateYesterday); i++) { PressNumber( aqString["GetChar"](DateYesterday, i)); } ClickOk()
Log["Message"]("Date inputed: " + aqConvert["DateTimeToFormatStr"](aqDateTime["Today"](), "%Y%m%d") ) for (var i = 0; i < aqString["GetLength"](DateToday); i++) { PressNumber( aqString["GetChar"](DateToday, i)); } ClickOk() }
It works for me perfectly on any other day. But I have an issue then it comes to the first day of the month