Sunday, June 27, 2010

Time and date function in Vbscript

Time and date in Vbscript

'MsgBox (Date ())

WScript.Echo (Date ())
WScript.Echo (Time ())
WScript.Echo Now ()
WScript.Echo Hour (Time)
WScript.Echo Month (Date)
WScript.Echo (Time ())
WScript.Echo MonthName (1)
WScript.Echo MonthName (12)
WScript.Echo second (time)
WScript.Echo Timer ()
WScript.Echo TimeSerial (13,56,8)
WScript.Echo Timevalue (Time)
WScript.Echo Weekday (Date)
WScript.Echo WeekdayName(Weekday(2))
WScript.Echo





Playing with string in Vbscript

Manipulating String

Dim var
var = " hello Word "
MsgBox var
temp = Trim (var)
MsgBox temp
MsgBox var
temp1 = UCase(Trim (var))
MsgBox temp1
temp2 = LCase(temp1)
MsgBox temp2


Few more function for string

Dim temp
temp = "12 3456781 "

MsgBox (temp)
MsgBox (Len (temp))
MsgBox (Left (temp, 3))
MsgBox (right (temp, 3))
MsgBox (Mid (temp,2,3))
MsgBox (Mid (temp,1,3))
MsgBox (Mid (temp,5,2))
MsgBox (Trim (temp))
MsgBox (StrComp ("YES","yes",(0))) ' 0 is a case sensitive option
MsgBox (StrComp ("yes","ye",(1)))
MsgBox (String (34,"*"))
WScript.Echo (String (34,"*")) ' Run with both wscript n script option in CMD '
MsgBox (StrReverse ("HEllo"))
 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | JCpenney Printable Coupons