-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parse方法发现个bug #47
Comments
timestamp()是获取时间戳的,时间戳定义为从格林威治时间1970年01月01日00时00分00秒起至现在的总秒数。地球上任何时区在任意时间点的时间戳都是相同的。但是不同时区,相同时间戳对应的当前时间不同。 |
举得例子可能说的不太明确
|
这里没问题,虽然parse()方法确实使用了parseBy Layout()方法,但是并没有将接收的carbon对象的Loc设置为Local。实际上,真正时区起作用的是display. go和getter. go里的方法,这些方法调用的是c. Loc |
你举的例子中,洛杉矶和北京1月1号对应的时间戳本来就是一样的,任何时区对应的时间戳都是一样的。时间戳不随时区改变而改变。 |
那反过来说下。。。时间戳一样,再不同时区的年月日应该一样么。?
…---原始邮件---
发件人: ***@***.***>
发送时间: 2021年3月17日(周三) 晚上9:07
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [golang-module/carbon] parse方法发现个bug (#47)
你举的例子中,洛杉矶和北京1月1号对应的时间戳本来就是一样的,任何时区对应的时间戳都是一样的。时间戳不随时区改变而改变。
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
不同时区对应的时间戳是相同的,但是同一时间戳对应不同时区的日期不同 |
相同日期不同时区对应的时间戳是不同的
…---原始邮件---
发件人: ***@***.***>
发送时间: 2021年3月17日(周三) 晚上9:17
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [golang-module/carbon] parse方法发现个bug (#47)
不同时区对应的时间戳是相同的,但是同一时间戳对应不同时区的日期不同
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
微信聊吧,gouguolei
…---原始邮件---
发件人: ***@***.***>
发送时间: 2021年3月17日(周三) 晚上9:23
收件人: ***@***.***>;
抄送: ***@***.***>;
主题: Re: [golang-module/carbon] parse方法发现个bug (#47)
<?php
$dtToronto = Carbon::createFromDate(2012, 1, 1, 'America/Toronto');
$dtVancouver = Carbon::createFromDate(2012, 1, 1, 'America/Vancouver');
&nbsp;
echo $dtVancouver-&gt;diffInHours($dtToronto); // 3
手机不方便码。只能粘贴了,这是php的carbon不同时区,相同的年月日时间戳是不同的
---原始邮件---
发件人: ***@***.***&gt;
发送时间: 2021年3月17日(周三) 晚上9:17
收件人: ***@***.***&gt;;
抄送: ***@***.******@***.***&gt;;
主题: Re: [golang-module/carbon] parse方法发现个bug (#47)
不同时区对应的时间戳是相同的,但是同一时间戳对应不同时区的日期不同
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
已修复 |
parse方法使用的是本地时区,而没有读取carbon示例里设置的时区,carbon.sertimezone().parse("").timestamp()不正确无法根据时区变化
The text was updated successfully, but these errors were encountered: