Questions tagged [toisostring]
30 questions
22
votes
2 answers
Why converting new.Date() .toISOString() changes the time?
I'm inserting a date in a database in two different format.
this is inserting as Datetime
var mydate;
mydate = new Date();
document.getElementById('clockinhour').value = mydate.toISOString().slice(0, 19).replace('T', ' ');
Output…

Sebastian Farham
- 815
- 2
- 13
- 27
2
votes
1 answer
Date format acting strange in redux devtools
I'm working with an existing codebase, and the existing code calls for a date from an endpoint. The expected value is an ISO string (i.e. "2020-01-09T07:41:02.6025984-05:00"):
// in my sagas:
export function* handleGetServerTime(): Generator {
…

Seth Lutske
- 9,154
- 5
- 29
- 78
2
votes
2 answers
toISOString() is subtracting day from value
I have this date format:
Tue Oct 20 2020 00:00:00 GMT+0100 (Central European Standard Time)
And when I do :
myValue.toISOString();
that's what I get
2020-10-19T23:00:00.000Z
It's subtracting a day.
How can I solve this without changing date format?

Nour May
- 21
- 1
- 5
2
votes
1 answer
How to resolve loss of minute precision formatting a moment in 12HR?
I've converted an ISO date string to a momentjs moment and then formatted that moment using .format("MM/DD/YYYY HH:MM").
When I output the final formatted moment, the minute value is incorrect as against the value read back from the iso string…

Brian Var
- 6,029
- 25
- 114
- 212
1
vote
0 answers
2022-03-27 +1 day - Bug or my Error in javascript in function toISOString?
After adding +1 day and converting to ISO format, it will not execute correctly on the entry date 2022-03-27.
Isn't it related to daylight saving time?
If I also added the time to the date (2022-03-07 05:00:00), then the date conversion was…

MatoP
- 11
- 1
1
vote
0 answers
Inconsistent date string parsing by Date().toISOString() in V8
Paying with new Date().toISOString(), I observe an inconsistency in parsing of the same date in different string formats: 2020-01-01 and 2020/01/01:
const opt1 = new Date("2020-01-01").toISOString();
document.write(`"2020-01-01":…

Mike
- 14,010
- 29
- 101
- 161
1
vote
2 answers
convert string to ISO date time in nodejs
Convert this date into ISO format in nodejs
created_at="September 17th 2019, 16:50:17.000";
let new_time = new Date(created_at);
created_at = new_time.toISOString();
console.log(created_at);
Output: Invalid Date
Exacting…

malik
- 41
- 2
- 8
1
vote
2 answers
Locale time on IONIC2 Datetime picker
I'm working with IONIC2, Angular2 and Typescript. I have an Datetime working as follows:
page.html
page.ts
date: string = new…

Samuel Fraga Mateos
- 583
- 1
- 7
- 21
1
vote
1 answer
How can I get a (MM-DD-YYYY) format from a UTC string in javascript?
I am working with a Date object in a different timezone than the console. I'm using utc string to get the actual time that was logged in that timezone. Is there an easy way to extract the (MM-DD-YYYY) from the utc string than just substringing into…

chonglawr
- 201
- 1
- 3
- 15
0
votes
0 answers
JavaScript .toISOString() function returning incorrect date
Here is my Cypress JS code:
cy.get('creationDateElement').then(date => {
const reformattedDate = new Date(date.text())
cy.log('Reformatted Date: ' + reformattedDate)
cy.log('ISO string: ' +…

user9847788
- 2,135
- 5
- 31
- 79
0
votes
1 answer
ToIsoString is not a function when I get my date object from v-datetimepicker
When I use Vuetify datetimepicker, I get the following date: "Wed Mar 16 2022 04:20:00 GMT+0100"
I need to convert this to ISO8601. But if I store this date in a variable called "date" and try to convert it like this:
date1 = new…

Lars
- 3
- 2
0
votes
3 answers
JavaScript - Convert date to ISOString() with milliseconds rounded to two digit
I am trying to set a date that has ISOString format but the milliseconds should be set to two digits.
If the ISOString returns 2021-11-02T05:49:12.704Z I want it to be 2021-11-02T05:49:12.70Z (milliseconds round to two places)
This is what I am…

Jay
- 339
- 1
- 7
- 23
0
votes
1 answer
Save IsoString with offset to database
Currently I have an app in development that would pull some data in Amazon selling partner api.
My goal is to replicate the reporting from Amazon's seller dashboard. Currently the account is is Eu region using Europe/Berlin timezone. I need to…

rai
- 197
- 2
- 14
0
votes
0 answers
I am getting an error when transforming datetime javascript
I'm using date.toISOString() to use DateTime format "yyyy-MM-dd'T'HH: mm: ss'Z '", I must use ISO 8601 format. At the time of transformation, the time is showing it 5 hours in advance, that is, I am receiving for example this hour 2020-12-03…
0
votes
0 answers
Angular App Error when trying to use XLSX.writeBuffer()
I'm getting a mysterious error when trying to use the xlsx.writeBuffer() method in my Angular app to try and download an Excel file to the client browser.
After finishing all the changes that needed to be made to the workbook, I try to download it…

A. Lewis
- 67
- 8