Home > Net >  How to get a start of day date in specific timezone
How to get a start of day date in specific timezone

Time:01-28

I am working with Date Picker component and I am trying to get selected day from date picker to be start of day (midnight) in specific timezone (e.g. Europe/London). So for example if I select 2023-01-30 I want to get something like

Mon Jan 30 2023 00:00:00 GMT (London UK)

Currently output shows my local timezone at the end GMT-0500 (Eastern Standard Time) but I would like to have London one GMT

I am using date-fns to get startOfDay

const d = '2023-01-30';
const [year, month, day] = d.split('-');
const y = startOfDay(new Date(year, month - 1, day));
console.log('           
  • Related