Questions tagged [gettime]

Use for questions related to the 'gettime' method, for getting the time in JavaScript.

The getTime() method returns the numeric value corresponding to the time for the specified date according to universal time.

You can use this method to help assign a date and time to another Date object. This method is functionally equivalent to the valueOf() method.

Read more in the ref.

128 questions
46
votes
4 answers

Why JavaScript getTime() is not a function?

I used the following function: function datediff() { var dat1 = document.getElementById('date1').value; alert(dat1);//i get 2010-04-01 var dat2 = document.getElementById('date2').value; alert(dat2);// i get 2010-04-13 var oneDay =…
udaya
  • 8,618
  • 15
  • 46
  • 66
33
votes
7 answers

jQuery getTime function

is it possible to create a jQuery function so that it gets current date and time? I've been looking around documentation but haven't found anything so far...
Tsundoku
  • 8,114
  • 26
  • 88
  • 125
10
votes
2 answers

Precise Linux Timing - What Determines the Resolution of clock_gettime()?

I need to do precision timing to the 1 us level to time a change in duty cycle of a pwm wave. Background I am using a Gumstix Over Water COM (https://www.gumstix.com/store/app.php/products/265/) that has a single core ARM Cortex-A8 processor running…
dillerj
  • 215
  • 2
  • 7
9
votes
5 answers

Android: Date (year,month,day)

I want to get the date as a year, month ,day without hours or minutes or any thing else, and I don't want to get the year alone and the month and the day each by its self. Because as a full date I need it to comparison with another date such as…
Android Developer
  • 1,019
  • 1
  • 9
  • 30
9
votes
1 answer

new Date().getTime() not returning timestamp in milliseconds

I've a class which is using java.util.Date class to create a date object and using getTime() to get current milliseconds. I've seen in the Java documentation that getTime() returns the milliseconds, and the same case is on my machine. I've one other…
Chinmay
  • 170
  • 1
  • 2
  • 13
8
votes
1 answer

What is the use of CLOCK_REALTIME?

I am reading about the difference between CLOCK_REALTIME and CLOCK_MONOTONIC Difference between CLOCK_REALTIME and CLOCK_MONOTONIC? The CLOCK_REALTIME has discontinuities in time, can jump forwards as well as backwards: is that a bug in this clock?…
Bionix1441
  • 1,717
  • 1
  • 18
  • 45
8
votes
2 answers

Calculate time difference between two times javascript

i've looking around how to do this and i found a lot of examples with complicated code. Im using this: var time1 = new Date(); var time1ms= time1.getTime(time1); //i get the time in ms then i do this in other part of the code var time2 = new…
pistoleta
  • 109
  • 1
  • 1
  • 6
7
votes
9 answers

Date.getTime() not including time?

Can't understand why the following takes place: String date = "06-04-2007 07:05"; SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm"); Date myDate = fmt.parse(date); System.out.println(myDate); //Mon Jun 04 07:05:00 EDT 2007 long…
Jake
  • 14,329
  • 20
  • 64
  • 85
7
votes
2 answers

python function to return javascript date.getTime()

I'm attempting to create a simple python function which will return the same value as javascript new Date().getTime() method. As written here, javascript getTime() method returns number of milliseconds from 1/1/1970 So I simply wrote this python…
user3599803
  • 4,641
  • 10
  • 50
  • 95
6
votes
2 answers

Get local Date string and time string

I am trying to get the LocaleDateString and the LocaleTimeString which that would be toLocaleString() but LocaleString gives you GMT+0100 (GMT Daylight Time) which I wouldn't it to be shown. Can I use something like: timestamp = (new…
jQuerybeast
  • 13,038
  • 35
  • 114
  • 189
6
votes
2 answers

Calendar getTimeInMillis() is timezone-dependent?

Java: Timezone why different timezone give same value in millisec referring to the above link I have supposed that getTimeInMillis() of Calendar class returns the number of milliseconds independently from time zone. But using the following code: …
GVillani82
  • 16,419
  • 26
  • 96
  • 162
6
votes
2 answers

Javascript getTime to php date

I have javascript that turns dates in my view to a time string using getTime(). That then is stored as a value for an option in my select form. Once it is passed to php, how do I turn that into a php date? I have done: echo date("m/d/Y",…
cdub
  • 21,144
  • 49
  • 157
  • 274
5
votes
1 answer

CouchDB: Get server-time with an http request in CouchApp

I need the server-time for "user-is-online" stats in my CouchApp. I work with jquery.couch.js and would prefer to have a url, e.g. /db/_design/app/time - which gets me a timestamp. How do I realize this?
jukempff
  • 945
  • 6
  • 12
5
votes
1 answer

wrong numbers with clock_gettime and CLOCK_PROCESS_CPUTIME_ID

I'm on a 64bit Ubuntu 12.04 system and tried the following code: #include #include #include int main(void) { struct timespec user1,user2; struct timespec sys1,sys2; double user_elapsed; double sys_elapsed; …
underdoeg
  • 1,713
  • 3
  • 13
  • 23
5
votes
1 answer

Javascript,getTime()

I am trying to understand something about getTime(), My problem is that, I am setting up a new Date with lets say: 23,07,2012. When I am using getTime() on it I should get the milliseconds Since 01,01,1970. When I divide the value I getting from…
Aviel Fedida
  • 3,702
  • 9
  • 48
  • 81
1
2 3
8 9