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.

142 questions
0
votes
1 answer

How to get time between two dates in hh:mm:ss format in react native?

i have start date and end date like below mentioned "start_date":"2019-05-21 10:00:00", "end_date":"2019-07-31 23:59:59", how to get a time difference between two dates in hh:mm:ss format ..i m new to react native
android_ar
  • 39
  • 5
0
votes
2 answers

Does getTime() of JS work correctly with not UTC time zone users?

I want to use this packet to work with cookies in my web app https://github.com/js-cookie/js-cookie In my web app my task is to extend the expire time (15 minutes) of cookie when user is do some actions. To extend the expire time I use this…
Raventus
  • 61
  • 1
  • 10
0
votes
2 answers

setHours() javascript returns a diffrent format then expected

I have this situation where I am in need of using the JavaScript setTime() So that I can modify the time, according to a number of seconds I have. For example I want to know what time it was 1400 sec ago. I come to the conclusion that my cleanest…
Jaquelline
  • 13
  • 4
0
votes
2 answers

Why getTime() in Javascript is timezone independent?

I was trying to understand if it's safe to execute (new Date()).getTime() in different timezones. By reading this question, it seems that it actually is time zone independent (assuming that the time on the machine where the script is executed was…
justHelloWorld
  • 6,478
  • 8
  • 58
  • 138
0
votes
1 answer

Break long getTime() into 4 shorts not really work Modbus

I am a beginner and I want to divide a long gettime into 4 shorts for the Modbus protocol, but it does not always work. I don't know why (maybe because of the casting). I hope someone may help me :) Thanks in advance to those who can enlighten…
Gabriel
  • 319
  • 3
  • 15
0
votes
3 answers

How to get current time in C using gettime()?

We're required to use gettime() to get the current time in C. I'm trying to print the current time but the error: error: storage size of 't' isn't known occurs. I don't know how to solve this. Here is the…
PG20
  • 67
  • 1
  • 2
  • 10
0
votes
3 answers

How get timestamp by UTC Date in javascript?

i would to get timestamp by UTC Date in javascript. I searched and read other questions but i didn't find a solution. I have this UTC Date 2017-07-16 12:00:07.8 UTC but if i use .getTime() it returns timestampt (milliseconds) in UTC removing…
Borja
  • 3,359
  • 7
  • 33
  • 66
0
votes
0 answers

Why Date("26/02/2017").getTime() return NaN?

I simply run: new_time = new Date("10/02/2017").getTime() and it return - 1506891600000 But, whet i run: new_time = new Date("26/02/2017").getTime() new_time = new Date("25/02/2017").getTime() new_time = new Date("16/02/2017").getTime() new_time =…
Ivan Stasiuk
  • 292
  • 6
  • 12
0
votes
1 answer

Substracting Dates in Javascript return a negative number

I am using the TimeTracker.js from link text to track Page Load times and put them in Google Analytics. Basically what it does is record a start time, and once the page loads it records a end time and then subtracts. These are recored using (new…
Peuge
  • 1,461
  • 5
  • 20
  • 37
0
votes
2 answers

Javascript leading zero

I'm trying to use getHours and getMinutes to use them on a later function. The problem is that I always want the final number to be 3 or 4 digit and 2 digit. What happens is when the minutes are 0-9 the result of 1:04 is 14. This is my code and it…
0
votes
1 answer

Compare two dates in different formats in javascript/jquery

I'm trying to compare two dates in different formats to highlight new items added from last visit but there is one problem with first date: jQuery( "td.details > span:last-child" ).each(function() { var a = jQuery( this ).text(); var b =…
Nidecker
  • 172
  • 8
0
votes
1 answer

JavaScript time-based score in Firefox

So i've got this problem, For a score function I have that increases by one per second, it works in Google Chrome (version 53.0.2785.116 m), Microsoft Edge (25.10586.0.0) however does not work in Firefox (version 49.0.1). Is this likely due to the…
LFJ__
  • 79
  • 1
  • 7
0
votes
1 answer

New time stamps are all the same date

Im trying to print current date on page as time stamp when a new task(obj) is displayed, but new time stamps are all the same date regardless of when the time stamp is made. Any assistance would be greatly appreciated. function getDate() { …
Kris
  • 33
  • 1
  • 7
0
votes
1 answer

JavaScript - date stored in localStorage won't cooperate with functions

I have a date stored in localStorage under the variable deadline (Tue Jul 05 2016 18:15:00 GMT+0100 (BST)) and I want to find the difference between this date and new Date() however any function I try to carry out with the locally stored date…
mellows
  • 303
  • 1
  • 7
  • 27
0
votes
1 answer

Is Repeated Assignment Defined for get_time?

I was working on this answer. And I ran into a conundrum: scanf has an assignment suppressing '*': If this option is present, the function does not assign the result of the conversion to any receiving argument But when used in get_time the '*'…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288