dtm1="18-Feb-10"
dtm2="19-Aug-10"
'To Get difference between two date
WScript.Echo "Difference between " & dtm1 & " and " & dtm2
'To Get month difference
intMonthsDifferent=DateDiff("m", dtm1, dtm2)
WScript.Echo "In month: " & intMonthsDifferent
'To Get date difference
intDateDifferent=DateDiff("d", dtm1, dtm2)
WScript.Echo "In date: " & intDateDifferent
If intMonthsDifferent > 0 Then
WScript.Echo "postive"
Else
WScript.Echo "negative"
End If
'Difference In date with difference format Another example
dtm1="18/02/1999"
dtm2="18/03/1998"
WScript.Echo "Difference between " & dtm1 & " and " & dtm2
intMonthsDifferent=DateDiff("m", dtm1, dtm2)
WScript.Echo "In month: " & intMonthsDifferent
intDateDifferent=DateDiff("d", dtm1, dtm2)
WScript.Echo "In date: " & intDateDifferent
If intMonthsDifferent > 0 Then
WScript.Echo "postive"
Else
WScript.Echo "negative"
End If
WScript.Echo "-----------------------------------------------"
WScript.Echo "Function To Get different value of current Date"
WScript.Echo "-----------------------------------------------"
WScript.Echo "Current Date:- " &(Date ())
WScript.Echo "Current Time:- " &(Time ())
WScript.Echo "Current Time:- " & TimeValue (Time)
WScript.Echo "Current Time and date:- " & Now ()
WScript.Echo "Hours:- " & Hour (Time)
WScript.Echo "Month:- " & Month (Date)
WScript.Echo "Second:- " & Second (time)
WScript.Echo "Total Seconds:- " & Timer ()
WScript.Echo "Time with User's Argument:- " & TimeSerial (13,56,8)
WScript.Echo Weekday (Date)
WScript.Echo "Day's name as per index:- " & WeekdayName(Weekday(1))
WScript.Echo "Day's name as per index:- " & WeekdayName(Weekday(2))
WScript.Echo "Day's name as per index:- " & WeekdayName(Weekday(3))
WScript.Echo "Day's name as per index:- " & WeekdayName(Weekday(8))
WScript.Echo "Month's name as per index:- " & MonthName (1)
WScript.Echo "Month's name as per index:- " & MonthName (12)
No comments:
Post a Comment