- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
代码:
console.log(start)
读取,2018 年 3 月 1 日星期四 00:00:00 GMT+0530(印度标准时间)
我想要一个新对象 start_NY ,它将读取 Thu Mar 01 2018 00:00:00 w.r.t. America/New_York
时区。类似于 2018 年 3 月 1 日星期四 00:00:00 GMT-0500。
我使用了一个脚本:
start_ny = new Date('Thu Mar 01 2018 00:00:00 GMT-0500');
但是上面写着,Thu Mar 01 2018 10:30:00 GMT+0530(印度标准时间),这实际上是将日期转换为印度标准时间,而不是给我一个时间纽约时区。
格式应与现有格式相同。我怎样才能做到这一点?
最佳答案
尝试使用以下代码和 MDN资源
new Date().toLocaleString('en-US', { timeZone: 'America/New_York' })
// Date Format
new Date().toDateString('en-US', { timeZone: 'America/New_York' });
关于javascript - 创建 javascript Date() 对象到 America/New_York 时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49221517/
尝试解析带有详细时区的日期: var sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); sdf.parse("2022-09-02 02:30:
我有一个从我的服务器发送的以毫秒为单位的时间戳 ( Unix time / time from Epoch ),它使用 Joda-time 并且始终使用恒定时区“America/New_York”。在
如何通过此类查询 MySQL 并在每次查询后设置 time_zone?我对于在以下代码块中放置时区命令的位置遇到一些麻烦: class MyDB { private $connection;
谁能告诉我,以下两种说法有什么区别: TimeZone.getTimeZone("America/New_York") 和 TimeZone.getTimeZone("EST") 换句话说,为什么 E
我有这段代码在 SQL 中运行良好。但是我想使用不同的时区格式,例如 'America/New_York' 而不是 'US Eastern Standard Time' SELECT TODATETI
有没有办法使用 moment.js 或 moment-timezone 设置时区始终反射(reflect)“美国/纽约”,无论用户从何处访问应用程序? 我已经尝试过此操作,但对象的时区反射(refle
这是我的代码 package main import ( "fmt" "time" ) func main() { tz := "America/New_York" loc, err
代码: console.log(start) 读取,2018 年 3 月 1 日星期四 00:00:00 GMT+0530(印度标准时间) 我想要一个新对象 start_NY ,它将读取 Thu Ma
我从我的 vendor 那里得到一个时间戳,它是美国中部时间但没有夏令时。我需要使用 DST(如果适用)将其转换为 America/New_York。 我尝试只使用常规 JavaScript,然后转向
从服务器收到的日期是 UTC 时区,我需要将其转换为特定时区,例如:America/New_York。以下是相同的代码 但是在这样做时我得到了以下错误: Moment Timezone has
我在我的表中存储 UTC 时区的日期,但我需要通过将日期从 UTC 转换为美国/纽约时区来导出 CSV 文件。 我已经尝试使用 CONVERT_TZ MySQL 函数,但它给出的是空值。 我如何仅使用
我必须使用时区“ET”(东部时间)。在Java中,没有ZoneId.of("ET")。 我应该使用哪一个来正确表示“ET”: ZoneId TIMEZONE_ET = ZoneId.of("US/Ea
异常(exception): Caused by: java.lang.IllegalArgumentException: The datetime zone id 'America/New_York
我正在使用 jboss 7.1.1。我想将时区 IST(印度)更改为 EST(纽约)。我有一个使用 java_opts 选项的解决方案。我将此代码放在 bin 文件夹中的 domain.conf 文件
我是一名优秀的程序员,十分优秀!