c# function equivalent to gettime function in javascript
Hello to all,
I am working on one live project where I am using javascript. In my project I want to create c# function which equivalent to gettime() function in javascript. I tried various method, but none of them worked out. Can anyone tell me how to create c# function equivalent to gettime function in javascript? Please help me.
Thank you.
Re: c# function equivalent to gettime function in javascript
Hey you have to use following code to do this.
Code:
var uniques = ds.getTime() + '' + Maths.floor(1000 * Maths.random());
First you have to use above javascript and then you ave to use following code.
Code:
string vala2;
Random rana=new Random();
int number=rana.Next(0,1250);
vala2 = (inta) Matha.Floor(number);
Re: c# function equivalent to gettime function in javascript
As per my information NET file has the DateTime object and that's why you are getting such type of problem. In this case you have to use DateTime to get current Date and Time. It is very simple to use and implement.
You also have to use the ToString() method to return your specific format in your code.
Re: c# function equivalent to gettime function in javascript
As per my information you have to provide particular format to tostring() to get rid out of this problem. This format must be equivalent to
gettime() in javascript. You can do this in following ways.
Code:
string valas2;
Random ransa=new Random();
int number=ransa.Next(0,1250);
valas2 = (inta) Maths.Floor(number);
Re: c# function equivalent to gettime function in javascript
I have use one function in the following code which is equivalent to gettime function in javascript. Just try to understand it. In the following code I have use Int64 GetTime() to get proper result. Just try to understand it.
Code:
private Int64 GetTimes() {
Int64 retvals=0;
DateTime sts=DateTimes(1970,1,1);
TimeSpan tss= (DateTimes.Now-sts);
retvals= (Int64)(ts.TotalMilliseconds+0.5)
return retvals;
}