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
2
votes
1 answer

Displaying Hours and Minutes as Words in JS

BACKGROUND: I'm using getHours() and getMinutes() to display the time on a page. PROBLEM: I'm trying to figure out how to convert the numerical time (i.e., "21:00") to a written-out hour and minutes format (i.e. "nine 0'clock"). My JS: function…
Marcatectura
  • 1,721
  • 5
  • 30
  • 49
2
votes
1 answer

Date.getTime() is taking to much time to process when in spanish

I am trying to convert "yyyy-MM-dd'T'HHmmssZZ" to unix time in my app. This is my code: public String getCreatedAt() { String formattedCreatedAt = twitterCreatedAt.replace(":", ""); SimpleDateFormat dateFormat = new SimpleDateFormat( …
roiberg
  • 13,629
  • 12
  • 60
  • 91
2
votes
4 answers

why javascript's .getTime() + 24*60*60*1000 get's stack after 27 Oct 2013?

I was just creating a simple calendar when users clicks next it gets the following day, very simple code: var dateSelected = new Date('02/06/2013'); //any date var day = new Date(dateSelected.getTime() + 24*60*60*1000); alert(day.getDate()); that…
matt
  • 2,312
  • 5
  • 34
  • 57
1
vote
1 answer

Javascript's getTime() function shows incorrect values?

I'm missing something, but I cannot find any hint online. When I use Javascript's getTime() function it seems it does not count from 1970, 01, 01, 0, 0, 0, 0 i.e. midnight 1970, but from 1969, 12, 01, 1, 0, 0, 0 I set up following: var d = new…
vucibatina
  • 107
  • 1
  • 6
1
vote
2 answers

Javascript new Date() give me the same result when executing getTime()

To compage 2 date i'm doing a conversion from a string to the javascript Date object. This is an exemple of the code i have: var date1 = new Date(dateArrray1[2], dateArrray1[1], dateArrray1[0], 0, 0, 0, 0); var date2 = new Date(dateArrray2[2],…
Muffun
  • 726
  • 1
  • 9
  • 27
1
vote
3 answers

How Implement Date when the object created in Java?

It's an homework. I have to implement the following: private Date dateCreated which store, when the object was created. private Date dateCreated; getter method for dateCreated. public Date getDateCreated() { return dateCreated; } And must…
blaces
  • 497
  • 3
  • 10
  • 24
1
vote
0 answers

Sort dates in Reactjs using Moment?

How to sort dates in Reactjs with the moment formatter? Tried this code and wont work const sortByDate = (d1,d2) => { new Date(d2).getTime() - new Date(d1).getTime() } dateFormat = (firstDate, lastDate) => { let first = moment(new…
Oashi
  • 39
  • 7
1
vote
2 answers

Year incorrect when setting Date value from Calendar.getTime()

I am building a CalendarDisplay application for Android. Among other things, this application allows the user to select the number of days to add to an epoch (epoch is a date in 1899), and that result will be represented graphically on the display.…
Dennis
  • 1,071
  • 2
  • 17
  • 38
1
vote
2 answers

Pyspark access data in folder XXX/2021/12/20

I have a pipeline running in Azure Synpase and I need to execute a pyspark code that create a current date folder. The structure must be "2021/12/10" (this is the lastest data that my pipeline was executed.. one folder for year, month and…
1
vote
2 answers

getTime() in format 'day-month-year' (Angular)

In a DB I have a date of birth in format day-month-year (like this "12-07-1997, 13-07-1997"). I want to get an age and use function like this: if (birthday) { let timeDiff = Math.abs(Date.now() - new Date(birthday).getTime()); let age =…
Carolina
  • 240
  • 4
  • 13
1
vote
1 answer

Flash getTimer() not working in Flash Builder 4.5

I've been following some tutorials and they use the function getTimer() in the actionscript code, but when I use it, it gives me: 1180: Call to a possibly undefined method getTimer. I'm using Flash Builder 4.5 for PHP and Flash CS5.5. The settings…
elcool
  • 6,041
  • 7
  • 29
  • 44
1
vote
1 answer

new Date().getTime() showing NaN in JavaScript

I am trying to save the current time inside a temporary object inside the timestamp key using new Date.getTime() and push it into an array which is inside a globally accessible variable, GLOBAL_VAR. But after I make the temporary variable and print…
Emmanuel Thomas
  • 159
  • 1
  • 12
1
vote
1 answer

Modelica getTime not available

I am unable to access the Modelica.Utilities.System.getTime() function on Modelica. For some reason it does not exist in the MSL in Plug-in dependencies. Any idea how to import this?
1
vote
0 answers

Javascript Date.getTime() returns NaN in internet Explorer 11 only

I have a below JavaScript function which returns time from the full date. function f() { var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" ]; d = new Date(); var utcOffset =…
Pranav Bilurkar
  • 955
  • 1
  • 9
  • 26
1
vote
1 answer

How does JavaScript Date.getTime() (milliseconds) map to a 64-bit float?

I am confused about JavaScript's Date object and its getTime() method. From: Minimum and maximum date It says that the actual max and min. number of milliseconds (ms) representable by a JS Date object is (-/+)8.640.000.000.000.000 ms since 01…
user4072916
1 2
3
9 10