如何从Javascript中的Date()函数获取斯里兰卡时间缩写 [英] How to get Sri Lanka time abbreviation from Date() function in Javascript
本文介绍了如何从Javascript中的Date()函数获取斯里兰卡时间缩写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
JavaScript Date() 函数返回 IST(印度标准时间)2016 年 4 月 7 日星期四 17:24:07 GMT+0530 (IST)
.
JavaScript Date() function returns IST(Indian Standard Time)
Thu Apr 07 2016 17:24:07 GMT+0530 (IST)
.
从这里我想获取缩写.但这总是返回印度标准时间.如何获取斯里兰卡时间缩写的缩写?
From this I want to fetch the abbreviation. But this always returns the Indian standard time. How do I get the abbreviation for Srilanka time abbreviation?
推荐答案
我认为这就是你所期望的答案
I think this is what you expect as the answer
const date = new Date().toLocaleString('en-US', { timeZone: 'Asia/Colombo'});
这篇关于如何从Javascript中的Date()函数获取斯里兰卡时间缩写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文