Forum Discussion
Anonymous
14 years agoHi Farhan,
I suggest that you try using the Today method of the aqDateTime object to return the current date. Then, you need to specify the format in which the current date should be displayed. To perform the conversion, you need to use the DateTimeToFormatStr method of the aqConvert object. For example, you can use the following code:
'Returns the current date
today = aqDateTime.Today()
'Specifies the format of the current date
todayUSA = aqConvert.DateTimeToFormatStr(aqDateTime.Now(), "%m/%d/%y")
'Outputs the result
Log.Message("Now: " & todayUSA)
Besides that, you can use the GetMonth, GetDay and GetYear methods of the aqDateTime object to accomplish your task. In this case, you can get the current month, day and year respectively and compose a string in the format you need to compare it with the date in your program. For example, see the code below:
'Returns the current date
today = aqDateTime.Today()
'Returns the month number of the specified date
Log.Message("Month: " & aqDateTime.GetMonth(today))
'Returns the ordinal number of a day in a month
Log.Message("Day: " & aqDateTime.GetDay(today))
'Returns the year number of the specified date
Log.Message("Year: " & aqDateTime.GetYear(today))