I believe d.toDateString() will output the format you're looking for.

var d = new Date();
d.setTime(1432851021000);
d.toDateString(); // outputs to "Thu May 28 2015"
d.toGMTString(); //outputs to "Thu, 28 May 2015 22:10:21 GMT"

Or even d.toLocaleString() "5/28/2015, 6:10:21 PM"

There are lots of methods available to Date()

Answer from gautsch on Stack Overflow
Discussions

How to remove timezone ?
Is anyone going to be using this feature outside of your current local time zone? Is that going to cause issues for you if you're storing the local time on the server? In all but a very few very small edge cases you are going to want to store the date in UTC with the time zone designation and then convert it to local time on the client. More on reddit.com
🌐 r/learnjavascript
6
0
May 7, 2025
Remove timezone from a moment.js object
I'm using datetimepicker.js and its date function returns a moment.js object. It does so with the local UTC offset in it and my original date has a different offset. My original date: 2015-10-0... More on github.com
🌐 github.com
4
December 4, 2015
javascript - How to ignore user's time zone and force Date() use specific time zone - Stack Overflow
I would like _date to convert this timestamp to current time in city of Helsinki in Europe (disregarding current time zone of the user). ... I know that time zone offset in Helsinki is +2 in winter and +3 in DST. But who knows when is DST? Only some locale mechanism that is not available in JS ... It is possible, but not using native methods of Javascript, because javascript has no method to determine a timezone ... More on stackoverflow.com
🌐 stackoverflow.com
November 22, 2011
Stop javascript Date function from changing timezone offset - Stack Overflow
JavaScript Date object do not store any timezone information, and when outputting/toStringing/logging them they will either use your local browser timezone (unfortunately default) or UTC (with explicit methods). ... But what if what I am trying to display is not in the browsers timezone. Why cant date parse string and set the date object to the timezone offset ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
DEV Community
dev.to › shubhampatilsd › removing-timezones-from-dates-in-javascript-46ah
Removing Timezones from Dates in Javascript - DEV Community
April 23, 2023 - Notice how the date is one day ahead and the time is 8 hours ahead of our given time. We can offset this difference simply by subtracting 8 hours (since I created this in the PST timezone) from the UTC time.
🌐
Reddit
reddit.com › r/learnjavascript › how to remove timezone ?
r/learnjavascript on Reddit: How to remove timezone ?
May 7, 2025 -

Hello,

I have a datepicker and it shows me example this:

Sun May 04 2025 15:30:00 GMT+0200 (Mitteleuropäische Sommerzeit)

if I send it to my backend with fetch in the network list it shows this:

2025-05-04T13:30:00

two hours different but I want to remove the timezone how I do it ?

let startTime = picker.value();

const send = async () => { 
  const res = await fetch('https://backend...', {
     method: 'POST',
  headers: {
    'Content-type': 'application/json; charset=UTF-8',
  },
  body: JSON.stringify({
    startTime
  }),
})
.....
},

I tried this

startTime.toISOString().slice(0, 19)

but not works it shows correctly in console.log but after send to my backend in the network tab in chrome it shows this:

2025-05-04T13:30:00

but it should be 15:30

🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getTimezoneOffset
Date.prototype.getTimezoneOffset() - JavaScript | MDN
const date1 = new Date("August 19, 1975 23:15:30 GMT+07:00"); const date2 = new Date("August 19, 1975 23:15:30 GMT-02:00"); console.log(date1.getTimezoneOffset()); // Expected output: your local timezone offset in minutes // (e.g., -120). NOT the timezone offset of the date object.
🌐
GitHub
github.com › moment › moment › issues › 2788
Remove timezone from a moment.js object · Issue #2788 · moment/moment
December 4, 2015 - I'm using datetimepicker.js and its date function returns a moment.js object. It does so with the local UTC offset in it and my original date has a different offset. ... Note how I removed the +01 offset at the end.
Author   alvarotrigo
🌐
W3Schools
w3schools.com › jsref › jsref_gettimezoneoffset.asp
JavaScript Date getTimezoneOffset() Method
altKey (Mouse) altKey (Key) animationName bubbles button buttons cancelable charCode clientX clientY code ctrlKey (Mouse) ctrlKey (Key) currentTarget data defaultPrevented deltaX deltaY deltaZ deltaMode detail elapsedTime elapsedTime eventPhase inputType isTrusted key keyCode location metaKey (Mouse) metaKey (Key) newURL oldURL offsetX offsetY pageX pageY persisted propertyName relatedTarget relatedTarget screenX screenY shiftKey (Mouse) shiftKey (Key) target targetTouches timeStamp touches type which (Mouse) which (Key) view HTML Event Methods
Find elsewhere
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-create-date-without-timezone
How to Create a Date without Timezone in JavaScript | bobbyhadz
March 6, 2024 - To create a Date without the timezone, we called the toISOString() method on the Date object and removed the character Z from the ISO string.
Top answer
1 of 7
82

A Date object's underlying value is actually in UTC. To prove this, notice that if you type new Date(0) you'll see something like: Wed Dec 31 1969 16:00:00 GMT-0800 (PST). 0 is treated as 0 in GMT, but .toString() method shows the local time.

Big note, UTC stands for Universal time code. The current time right now in 2 different places is the same UTC, but the output can be formatted differently.

What we need here is some formatting

var _date = new Date(1270544790922); 
// outputs > "Tue Apr 06 2010 02:06:30 GMT-0700 (PDT)", for me
_date.toLocaleString('fi-FI', { timeZone: 'Europe/Helsinki' });
// outputs > "6.4.2010 klo 12.06.30"
_date.toLocaleString('en-US', { timeZone: 'Europe/Helsinki' });
// outputs > "4/6/2010, 12:06:30 PM"

This works but.... you can't really use any of the other date methods for your purposes since they describe the user's timezone. What you want is a date object that's related to the Helsinki timezone. Your options at this point are to use some 3rd party library (I recommend this), or hack-up the date object so you can use most of it's methods.

Option 1 - a 3rd party like moment-timezone

moment(1270544790922).tz('Europe/Helsinki').format('YYYY-MM-DD HH:mm:ss')
// outputs > 2010-04-06 12:06:30
moment(1270544790922).tz('Europe/Helsinki').hour()
// outputs > 12

This looks a lot more elegant than what we're about to do next.

Option 2 - Hack up the date object

var currentHelsinkiHoursOffset = 2; // sometimes it is 3
var date = new Date(1270544790922);
var helsenkiOffset = currentHelsinkiHoursOffset*60*60000;
var userOffset = _date.getTimezoneOffset()*60000; // [min*60000 = ms]
var helsenkiTime = new Date(date.getTime()+ helsenkiOffset + userOffset);
// Outputs > Tue Apr 06 2010 12:06:30 GMT-0700 (PDT)

It still thinks it's GMT-0700 (PDT), but if you don't stare too hard you may be able to mistake that for a date object that's useful for your purposes.

I conveniently skipped a part. You need to be able to define currentHelsinkiOffset. If you can use date.getTimezoneOffset() on the server side, or just use some if statements to describe when the time zone changes will occur, that should solve your problem.

Conclusion - I think especially for this purpose you should use a date library like moment-timezone.

2 of 7
21

To account for milliseconds and the user's time zone, use the following:

var _userOffset = _date.getTimezoneOffset()*60*1000; // user's offset time
var _centralOffset = 6*60*60*1000; // 6 for central time - use whatever you need
_date = new Date(_date.getTime() - _userOffset + _centralOffset); // redefine variable
🌐
Telerik
telerik.com › knowledge base › managing time zones with the dateinputs components
Angular Managing Time Zones with the DateInputs Components - Kendo UI for Angular
January 20, 2026 - As a result, the applied time offset ... details, see the following GitHib issue. To remove the time zone information from a Date object, use the toISOString() method....
Top answer
1 of 7
8

While MomentJS is a great library, it may not provide a solution for every use case. For example, my server provides dates in UTC, and when the time portion of the date is not saved in the db (because it's irrelevant), the client receives a string that has a default time of all zeros - midnight - and ends with an offset of +0000. The browser then automatically adjusts for my local time zone and pulls the time back by a few hours, resulting in the previous day.

This is true with MomentJs as well.

One solution is to slice off the time portion of the string, and then use MomentJS as described in the other answers.

But what happens if MomentJS is not a viable option, i.e. I already have many places that use a JS Date and don't want to update so many lines of code? The question is how to stop the browser from converting dates based on local time zone in the first place. And the answer is, when the date is in ISO format, you cannot.

However, there is no rule that says the string you pass to JavaScript's Date constructor must be in ISO format. If you simply replace the - that separates the year, month, and day with a /, your browser will not perform any conversion.

In my case, I simply changed the format of the Dates server-side, and the problem was solved without having to update all the client-side JS dates with MomentJS.

Note that the MDN docs for JavaScript's Date class warn about unpredictable browser-behavior when parsing a string to create a Date instance.

2 of 7
7

You cannot change this behavior of Javascript because it is the only simple way for Javascript to work. What happens is simply that Javascript looks at the time shift, computes the matching timestamp, and then asks the OS for the representation of this timestamp in the local time zone. What is key to understand here is that -05:00 is not an indication of time zone but simply a shift from UTC.

Time zones are complex beasts that are just arbitrary political decisions. The OS provides a service to display time in the local time zone, but not in other time zones. To do that you have to take in account things like DST that are pretty much a hell.

As always with time management, the only decent way to tackle this problem is to use a dedicated library. In Javascript, you'll find Moment.js and Moment.Timezone.js very helpful.

Example http://codepen.io/Xowap/pen/XKpKZb?editors=0010

document.write(moment('2013-07-18T17:00:00-05:00').tz('America/New_York').format('LLL'));

As a bonus, you get a ton of formatting/parsing features from Moment.js.

Please also note that as long as you use the ISO 8601, your date can be pinpointed to a precise moment, and thus be displayed in any timezone of your liking. In other words, JS "converting" your date doesn't matter.

🌐
Medium
toastui.medium.com › handling-time-zone-in-javascript-547e67aa842d
Handling Time Zone in JavaScript. Recently, I worked on a task of adding… | by TOAST UI | Medium
August 30, 2019 - Or what if you need to display a variety of time zones at the same time in a single application? Like I said several times, JavaScript does not allow manual change of local time zone. The only solution to this is adding or removing the value of the offset from the date provided that you already know the value of the time zone’s offset.
🌐
Webdevtutor
webdevtutor.net › blog › javascript-date-remove-timezone-offset
How to Remove Timezone Offset from JavaScript Date Objects
This offset is crucial for displaying ... considering the timezone. To remove the timezone offset from a JavaScript Date object, you can utilize the getTime() and setTime() methods....
🌐
Telerik
telerik.com › javascript › timezone › remove
remove - API Reference - Kendo UI timezone - Kendo UI for jQuery
<script> var version = kendo.version; $.getScript( "https://kendo.cdn.telerik.com/" + version + "/js/kendo.timezones.min.js", loadExample, ); function loadExample() { var targetDate = new Date(2016, 10, 5, 15, 25, 11); var convertedDate1 = kendo.timezone.remove(targetDate, "Etc/GMT-6"); var convertedDate2 = kendo.timezone.remove(targetDate, -360); /* The result can be observed in the DevTools(F12) console of the browser.
🌐
Ursahealth
ursahealth.com › new-insights › dates-and-timezones-in-javascript
Working with dates and timezones in JavaScript: a survival guide
May 4, 2021 - To render this date with confidence we have to actually change the universal time that the JavaScript object is trying to represent. Remember that getTime() converts the date to an integer representing milliseconds. If we back out the server timezone offset, and apply the local timezone offset, we will have shifted the universal time from the server’s midnight to the user’s local midnight.
🌐
GitHub
gist.github.com › lvl99 › af20ee34f0c6e3984b29e8f0f794a319
Date ISO string without timezone information · GitHub
Date ISO string without timezone information · Raw · date-iso-string-without-timezone.js · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
CoreUI
coreui.io › blog › how-to-manage-date-and-time-in-specific-timezones-using-javascript
How to Manage Date and Time in Specific Timezones Using JavaScript · CoreUI
January 22, 2025 - For example, the timezone offset in New York changes during DST transitions. Using APIs like Intl.DateTimeFormat or libraries ensures these adjustments are handled automatically. Timezone abbreviations (e.g., EST, PST) can cause confusion as they aren’t standardized globally. Relying on IANA timezone names (e.g., America/New_York) is recommended for accuracy. Effectively handling dates and times in specific timezones requires a mix of native JavaScript capabilities and third-party libraries.
🌐
Reddit
reddit.com › r/react › [deleted by user]
How the hell do you store a DATE without offset : r/react
July 11, 2024 - If you store them in utc they will properly offset automatically according to browser location when it comes to the front end. I have spent too much time figuring this out while working with enterprise apps that store dates in fucking Pacific time zone because the server is in California. For those cases you have to apply the local timezone (America/Los_Angeles in my case) offset to get it back to UTC and then store it in the db.
🌐
Stack Overflow
stackoverflow.com › questions › 59426172 › removing-offset-from-a-javascript-date
Removing offset from a javascript Date - Stack Overflow
December 20, 2019 - describe('.removeLocalDateOffset()', () => { it('removes the timezone offset', () => { const input = '2017-10-03T08:53:12.000-07:00'; const result = removeLocalDateOffset(input); expect(result.toISOString()).toBe('2017-10-03T08:53:12.000Z'); }); }); ... const removeLocalDateOffset = (date) => { const originalDate = new Date(date); return new Date(Date.UTC( originalDate.getFullYear(), originalDate.getMonth(), originalDate.getDate(), originalDate.getHours(), originalDate.getMinutes(), originalDate.getSeconds(), )); }