Friday, 31 October 2014

Convert Current Date and Time to Unix Time Stamp (Epoch)

What is Unix/Epoch time?
The 
Unix time-stamp(epoch time) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

C# Code for Unix Time-stamp in milliseconds

public static string Unix_TimeStamp()
{
return (Math.Truncate((DateTime.UtcNow-new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds).ToString());
}

Unix Time-stamp in milliseconds for Jmeter

${__javaScript(new Date().getTime())}




No comments:

Post a Comment