Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



c# function equivalent to gettime function in javascript

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 10-03-2010
Member
 
Join Date: Nov 2009
Posts: 35
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.

Reply With Quote
  #2  
Old 10-03-2010
Member
 
Join Date: Nov 2005
Posts: 1,323
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);
Reply With Quote
  #3  
Old 10-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,387
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.
Reply With Quote
  #4  
Old 10-03-2010
Member
 
Join Date: May 2008
Posts: 2,376
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);
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #5  
Old 10-03-2010
Member
 
Join Date: Feb 2008
Posts: 1,843
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;
 }
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "c# function equivalent to gettime function in javascript"
Thread Thread Starter Forum Replies Last Post
c++ equivalent function to the c-function 'sprintf Dilbert Software Development 6 13-12-2011 03:03 PM
C# Equivalent Of Javascript's Location.replace() Function? ASHER Software Development 6 16-05-2010 01:20 AM
Javascript isNull function Chrisch Software Development 3 11-11-2009 01:51 PM
How to implement the INITCAP equivalent function in SQL Server TechPredator Software Development 3 06-08-2009 03:33 PM
JavaScript function help suseman Software Development 3 26-05-2009 05:11 AM


All times are GMT +5.5. The time now is 06:40 PM.