Get Random Time Span - CSharp System

CSharp examples for System:TimeSpan

Description

Get Random Time Span

Demo Code


using System.Globalization;
using System.Text.RegularExpressions;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;/*from  w ww  .  j  av  a2s.c  o  m*/

public class Main{
        public static string GetRandomTimeSpan()
        {
            TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
            return Convert.ToInt64(ts.TotalSeconds).ToString();
        }
}

Related Tutorials