Try using utcToZonedTime()

To change the displayed date/time returned from format(), you must use either:

  • utcToZonedTime: when you want to know what the local date is in another timezone
  • zonedTimeToUtc: when you want to know what a date in another timezone is in the local timezone

Working Demo

Answer from User863 on Stack Overflow
๐ŸŒ
JavaScript in Plain English
javascript.plainenglish.io โ€บ date-manipulation-in-js-made-easy-with-date-fns-6c66706a5874
Date manipulation in JS made easy with date-fns | by Unpackaged Reviews | JavaScript in Plain English
July 28, 2020 - This helper module can be installed by running npm install date-fns-tz and also provides typescript support. If your system has the date-time stored in a particular timezone and have to convert it to UTC then the zonedTimeToUTC method is the way to go. It takes a date and the timezone in the IANA format of the input date time.
๐ŸŒ
Mastering JS
masteringjs.io โ€บ tutorials โ€บ date-fns โ€บ tz
Working with Timezones using date-fns and date-fns-tz - Mastering JS
Date-fns has a sibling library date-fns-tz that helps you work with timezones in JavaScript, including formatting dates in a specific timezone.
Discussions

How to format hour and minutes in date-fns?
I'm migrating my code from MomentJS to date-fns and having the following issue when setting the hour and minutes. ... var someDate = moment.utc('2020-07-16T16:35:39.955873Z')) // 2020-07-16T16:35:39.955Z console.log(someDate.format('MM/DD/YYYY [ at ] LT ')); // 07/16/2020 at 4:35 PM More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to format date with date-fns?
I've been trying to format a date using date-fns but I keep failing. Basically I have it working just fine with momentJS but not with date-fns: Here's my date: "10-13-20" // month, day, and More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to convert ISO to date using date-fns
format(parseISO('2022-04-19T08:59:10.177Z'), 'eeee do MMM, yyyy')
More on reddit.com
๐ŸŒ r/reactjs
11
0
October 8, 2020
What library do you use to handle dates?
When I'm asked to handle dates, I just quit and find a job elsewhere. More on reddit.com
๐ŸŒ r/reactjs
86
30
June 5, 2023
๐ŸŒ
date-fns
date-fns.org
date-fns - modern JavaScript date utility library
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
๐ŸŒ
jsDelivr
jsdelivr.com โ€บ package โ€บ npm โ€บ date-fns-format
date-fns-format CDN by jsDelivr - A CDN for npm and GitHub
April 29, 2024 - A free, fast, and reliable CDN for date-fns-format. Format options for date-fns
Published ย  Apr 29, 2024
๐ŸŒ
npm
npmjs.com โ€บ package โ€บ date-fns
date-fns - npm
import { compareAsc, format } from "date-fns"; format(new Date(2014, 1, 11), "yyyy-MM-dd"); //=> '2014-02-11' const dates = [ new Date(1995, 6, 2), new Date(1987, 1, 11), new Date(1989, 6, 10), ]; dates.sort(compareAsc); //=> [ // Wed Feb 11 1987 00:00:00, // Mon Jul 10 1989 00:00:00, // Sun Jul 02 1995 00:00:00 // ] The library is available as an npm package.
      ยป npm install date-fns
    
Published ย  Sep 17, 2024
Version ย  4.1.0
Find elsewhere
๐ŸŒ
StackBlitz
stackblitz.com โ€บ edit โ€บ js-fnwevt
date format using date-fns - StackBlitz
StackOverflow #54443161 Answer for question: https://stackoverflow.com/questions/54443161/parse-and-format-date-in-string/54443704#54443704 Using date-fns 2.0.0-alpha.27
๐ŸŒ
Nuxt
nuxt.com โ€บ modules โ€บ date-fns
@nuxtjs/date-fns ยท Nuxt Modules
For typescript to be aware of the additions to the nuxt Context, the vue instance and the vuex store, the types need to be merged via declaration merging by adding @nuxtjs/date-fns to your types. ... Locales to be imported. ... You can preset default locale. ... You can preset a fallback locale for when a method is called with an unsupported locale. ... You can preset default format.
๐ŸŒ
Michaelbonner
date-fns.michaelbonner.dev
date-fns format helper
A simple tool to help keep track of commonly used date formats. The tool is also helpful to test custom date formats.
๐ŸŒ
DEV Community
dev.to โ€บ dmtrkovalenko โ€บ you-might-not-need-date-fns-23f7
You might not need date-fns - DEV Community
May 10, 2021 - But one day I said that date-fns ... date-fns' maintainer blocked me everywhere because it says that you might not need it. So probably this thread contains some useful information for people that choosing date lib โ€“ so I decided to share it in the blog as well! Hope you will have some fun reading it :) That's it for prerequisites so let's start the discussion ยท First of all, when you need to only show date values in the user-readable format โ€“ you can ...
๐ŸŒ
Fulcrumapp
help.fulcrumapp.com โ€บ en โ€บ articles โ€บ 4037876-date-manipulation-with-date-fns
Date Manipulation with date-fns | Fulcrum Help Center
Working with JavaScript dates and times can quickly become challenging and date-fns provides over 140 functions for comparing, manipulating, and formatting dates and timestamps.
๐ŸŒ
Date-fns
blog.date-fns.org โ€บ v40-with-time-zone-support
v4.0 is out with first-class time zones support!
September 16, 2024 - I plan to extract custom locales and locale-dependant functions to separate packages like @date-fns/es and make the Intl-based format the default way to render dates.
๐ŸŒ
GitHub
github.com โ€บ date-fns โ€บ date-fns
GitHub - date-fns/date-fns: โณ Modern JavaScript date utility library โŒ›๏ธ
import { compareAsc, format } from "date-fns"; format(new Date(2014, 1, 11), "yyyy-MM-dd"); //=> '2014-02-11' const dates = [ new Date(1995, 6, 2), new Date(1987, 1, 11), new Date(1989, 6, 10), ]; dates.sort(compareAsc); //=> [ // Wed Feb 11 1987 00:00:00, // Mon Jul 10 1989 00:00:00, // Sun Jul 02 1995 00:00:00 // ] The library is available as an npm package.
Author ย  date-fns
๐ŸŒ
Envato Tuts+
code.tutsplus.com โ€บ home โ€บ javascript
Using date-fns for Easy Date Manipulation | Envato Tuts+
July 28, 2023 - In this code, we parse the date from the dateString using the format yyyy-MM-dd, which corresponds to the provided date string. The third argument is the base date to use for calculating the parsed date. In this case, we use the current date as the base. Manipulating dates by adding or subtracting time intervals is a common requirement in date handling. date-fns provides a set of convenient functions to perform these operations with ease.
๐ŸŒ
date-fns
date-fns.org โ€บ docs โ€บ format
date-fns/format
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
๐ŸŒ
Laravel
laravel.cm โ€บ articles โ€บ how-to-use-dates-in-javascript-with-the-date-fns-library-2
How to Use Dates in JavaScript with the date-fns Library | Laravel Cameroon
January 8, 2025 - To get started , you need to install the library , Use npm or yarn to add it to your project npm install date-fns or yarn add date-fns ยท Formatting dates is one of the most common tasks in date handling , with date-fns , you can use the format function to convert a Date object into readable string.
๐ŸŒ
date-fns
date-fns.org โ€บ v2.0.0-alpha.25 โ€บ docs โ€บ format
Date formats
date-fns provides the most comprehensive yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
๐ŸŒ
npm
npmjs.com โ€บ package โ€บ date-fns-tz
date-fns-tz - npm
This function takes a Date instance in the system's local time or an ISO8601 string, and an IANA time zone name or offset string. It then formats this date in the target time zone regardless of the system's local time zone.
      ยป npm install date-fns-tz
    
Published ย  Sep 30, 2024
Version ย  3.2.0
Author ย  Marnus Weststrate