Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
General Function - Get TimestampThis function gets a string based on the date/time in the form 'yyyymmddhhmiss' Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Function xGen_GetTimeStamp 'This function generates a unique timestamp 'Which is handy for use in filenames 'Usage: 'sTimeStamp = xGen_GetTimeStamp 'Where 'The returned value is of the form YYYYMMDDHHMISS 'Note that single values are padded out with leading zeroes Dim sYYYY, sMM, sDD, sHH, sMI, sSS sYYYY = Year(Date) sMM = Right("0" & cStr(Month(Date)),2) sDD = Right("0" & cStr(Day(Date)),2) sHH = Right("0" & cStr(Hour(Time)),2) sMI = Right("0" & cStr(Minute(Time)),2) sSS = Right("0" & cStr(Second(Time)),2) xGen_GetTimeStamp = sYYYY & sMM & sDD & sHH & sMI & sSS End Function '========================================================================= |