This content originally appeared on DEV Community and was authored by Muhammad Hasbi
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
This content originally appeared on DEV Community and was authored by Muhammad Hasbi
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Muhammad Hasbi | Sciencx (2025-06-11T17:18:19+00:00) Convert UTC with Day.JS. Retrieved from https://www.scien.cx/2025/06/11/convert-utc-with-day-js/
" » Convert UTC with Day.JS." Muhammad Hasbi | Sciencx - Wednesday June 11, 2025, https://www.scien.cx/2025/06/11/convert-utc-with-day-js/
HARVARDMuhammad Hasbi | Sciencx Wednesday June 11, 2025 » Convert UTC with Day.JS., viewed ,<https://www.scien.cx/2025/06/11/convert-utc-with-day-js/>
VANCOUVERMuhammad Hasbi | Sciencx - » Convert UTC with Day.JS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/06/11/convert-utc-with-day-js/
CHICAGO" » Convert UTC with Day.JS." Muhammad Hasbi | Sciencx - Accessed . https://www.scien.cx/2025/06/11/convert-utc-with-day-js/
IEEE" » Convert UTC with Day.JS." Muhammad Hasbi | Sciencx [Online]. Available: https://www.scien.cx/2025/06/11/convert-utc-with-day-js/. [Accessed: ]
rf:citation » Convert UTC with Day.JS | Muhammad Hasbi | Sciencx | https://www.scien.cx/2025/06/11/convert-utc-with-day-js/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.