Convert UTC with Day.JS

Put this code into main file import dayjs from "dayjs"; import utc from "dayjs/plugin/utc"; import timezone from "dayjs/plugin/timezone"; dayjs.extend(utc); dayjs.extend(timezone); dayjs.tz.setDefault("Asia/Singapore"); // set as globally to get date export const getDate = (date:string) => dayjs(value).format("YYYY-MM-DD") to get time export const getDate = (date:string) => dayjs(value).format("HH:mm:ss") for more visit the doc here Day.Js

Jun 11, 2025 - 18:50
 0
Convert UTC with Day.JS

Put this code into main file

import dayjs from "dayjs";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.tz.setDefault("Asia/Singapore"); // set as globally

to get date

export const getDate = (date:string) => dayjs(value).format("YYYY-MM-DD")

to get time

export const getDate = (date:string) => dayjs(value).format("HH:mm:ss")

for more visit the doc here Day.Js