问题标签 [tzinfo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
489 浏览

python - 为什么 Django 称我的日期时间不天真?

我有一个在 Django 1.6 中构建的博客系统,我正在尝试从我的 Post 模型的 DateTimeField pub_date 呈现一个 YearArchiveView,或者至少获取一个包含帖子的年份列表。它一直告诉我我的 pub_date 是幼稚的,但我已经明确地将它们更改为不幼稚。

这是我在 python shell 上所做的一些操作:

这到底是怎么回事?我要疯了!

0 投票
2 回答
945 浏览

ruby - 如何从 utc 偏移量获取 tz 标识符字符串

如何在America/Toronto考虑 DST 更改的同时以 tzinfo 格式获取时区,即以秒为单位的 utc 偏移量。

例如,DST 设置上次更改时间为 2014 年 3 月 9 日凌晨 2:00。见偏移差异

对于这两个时间示例,计算的 tzinfo 字符串应该相同,因为只有偏移量的差异是由于 DST 造成的。

0 投票
10 回答
42262 浏览

ruby-on-rails - TZInfo::DataSourceNotFound 在 Windows 上启动 Rails v4.1.0 服务器时出错

我使用 Ruby on Rails v4.1.0 创建了一个新应用程序。尝试在 Windows 上启动服务器或控制台时,遇到以下错误:

如何解决此错误?

0 投票
3 回答
6886 浏览

ruby-on-rails - ruby on rails 服务器没有启动

嗨,当我尝试运行时rails server,它只是退出并显示以下消息:

有人可以让我知道我错过了什么吗?

0 投票
1 回答
903 浏览

ruby-on-rails - rails 服务器问题(rails 4.1.1)

我是 RoR 的初学者,我在尝试使 rails 服务器正常工作时遇到了非常糟糕的事情。每次我运行命令

它总是显示所有这些行

我希望你们能帮我解决这个问题

0 投票
1 回答
2258 浏览

ruby-on-rails - Ruby on Rails can't connect to localhost:3000, 127.0.0.1:3000 and 0.0.0.0:3000 on Windows

I'm a total newbie learning Ruby on Rails and using a Windows machine. The steps used to install ruby on rails were:

  1. download ruby200-x64 installer for Windows
  2. then run the following commands

    • ruby dk.rb init
    • ruby dk.rb install
    • gem install bundler
    • gem install sqlite3
    • gem install rails
    • rails new testapp
    • cd testapp
    • bundle exec rails server which means that I ran rails server in the testapp folder and part of the output says this:

      • Booting WEBrick
      • Rails 4.1.1 application starting in development on 0.0.0.0:3000
      • Run rails server -h for more startup options
      • Notice: server is listening on all interfaces 0.0.0.0. Consider using 127.0.0.1
      • Ctrl-C to shutdown server
      • Exiting
      • C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb: No source of timezone data could be found. Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error
      • Follow by more lines of codes (sorry, didn't have enough reputation points to post an image.
  3. Finally when I tried to connect to localhost:3000, 127.0.0.1:3000, or 0.0.0.0:3000. None worked. Any ideas? I'm guessing it has to do something with the Exiting line.

0 投票
1 回答
3449 浏览

python - 为什么 pytz localize() 不生成一个 tzinfo 与本地化它的 tz 对象匹配的 datetime 对象?

有没有人可以帮助我了解这里发生了什么?

我的理解是,localize()pytz 时区对象上的方法将采用一个简单的日期时间对象,并添加一个tzinfo与执行本地化的时区对象相匹配的属性。在这种情况下,这似乎没有发生。

显然,我对时区或 pytz 处理时区的方式有一些误解。谁能解释一下?

0 投票
1 回答
289 浏览

ruby-on-rails - RoR Hartl 教程 - Win 64 位上的 tzinfo 冲突

我在 railstutorial.org 上做 Hartls 的教程

我需要在我的 64 位 Windows 机器上运行 Rails 4.0.8。这意味着我必须在我的 tzinfo-data Gem 上指定 x64_mingw 选项才能修复 Rails 时区错误。

  • Rails 4.0.8 需要 tzinfo v 0.3.37

  • x64_mingw 需要 tzinfo v 1.0.0

  • 捆绑失败并出现“不兼容的 tzinfo 版本”错误。

我该怎么办?我已经完成了一半,我现在不想切换开发机器!我知道配置在 32 位操作系统上运行良好。

.

.


宝石文件 =>

0 投票
3 回答
61343 浏览

python - datetime.strptime() 的 Python 时区“%z”指令不可用

使用 datetime.strptime() 的 '%z' 模式

我有一个代表日期的字符串文本,我完全能够解析它并将其转换为一个干净的日期时间对象:

除了我无法使用此处指定的%z 模式捕获具有时区的整个日期字符串

因为正如这个错误报告所说

strftime() 是按平台实现的

我确切地说,天真的 tzinfo 指令 '%Z' 没有这样的问题

解决方法:将 tzinfo 字符串转换为 tzinfo 对象

我可以通过使用dateutil模块将 GST 时间格式字符串转换为 tzinfo 对象 [如建议的此处] [4] 完美地做出以下解决方法,然后将tzinfo 插入 datetime 对象

问题:让 %z 可用于我的平台?

但是由于我显然需要 %z 模式来进行进一步的项目,所以我想找到一个解决方案来避免这种解决方法并使用外部模块来完成这个简单的任务。你能建议我读一下吗?我认为较新版本的 python(我在 2.7 上)可以处理它,但我宁愿现在不为这个小小的但至关重要的细节更改我的版本。

[编辑]

好吧,看到评论让我重新提出了我的问题,如何在不知道语言环境时间的情况下使用 strptime() 解析电子邮件时区指示符?

0 投票
1 回答
78 浏览

ruby - Sequel Gem TZInfo to UTC offset - 前端的城市名称

我在后端定义了一个模型,定义为

在我的前端反应组件中,我需要以 UTC-5 Ontario 等格式显示时区。有没有办法做到这一点?

我的数据库包含来自 TZInfo gem 的所有时区标识符。

我没有使用 Rails。