Simple Date/Time stamp - use for Unique File Names
Posted: Fri Nov 15, 2024 12:46 pm
Code: Select all
Option Explicit
wscript.echo dateTime
function dateTime()
dim ccTime,ccDate,hh,mm,ss,y,m,d,colPos,hhmm
ccTime= now
hhmm = FormatDateTime(ccTime,4)
colPos = instr(hhmm,":")
hh= left(hhmm,colPos-1)
hh=zeroPad(hh)
mm= zeroPad(minute(ccTime))
ss= zeroPad(second(ccTime))
y= year(ccTime)
m= zeroPad(month(ccTime))
d= zeroPad(day(ccTime))
dateTime = y & "-" & m & "-" & d & "_" & hh & ":" & mm & ":" & ss
end function
function zeroPad(strDigits)
dim strTmp
strTmp=right("0" & strDigits,2)
zeroPad = strTmp
end function