【问题标题】:Sales Force UTC time conversion in railsRails 中的销售队伍 UTC 时间转换
【发布时间】:2017-10-05 07:30:17
【问题描述】:

salesforce 返回的时间采用这种格式2017-07-14T12:02:23.000+0000 但我想转换我保存的已更新时间_Wed, 04 Oct 2017 23:00:45 PDT -07:00 我尝试使用 time_var.utc 将其转换为 utc 但它返回了2017-10-05 06:00:45 UTC 我怎样才能得到salesforce格式2017-07-14T12:02:23.000+0000的时间@

【问题讨论】:

  • 您可能会在专用的 StackExchange 上获得更好的帮助:salesforce.stackexchange.com
  • 我正在尝试在 Ruby on rails 中进行转换。 Salesforce 时间格式不会更改/或者我们必须遵循相同的格式
  • 请将您的代码添加到问题中,这将有助于理解问题所在
  • 2017-10-05 06:00:45 UTC 有什么问题?
  • salesforce 查询不会将其与 CreatedDate 返回比较,需要消息有效数据时间值

标签: ruby-on-rails ruby time salesforce


【解决方案1】:

time_in_utc = DateTime.parse product.updated_at.utc.to_s last_update_time = time_in_utc.iso8601

【讨论】:

    【解决方案2】:
    updated_at = "Wed, 04 Oct 2017 23:00:45:032 PDT -07:00"
    Time.parse(updated_at).utc.strftime("%Y-%m-%dT%T.%L%z")
    

    【讨论】:

      猜你喜欢
      • 2021-10-30
      • 1970-01-01
      • 2012-07-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-16
      • 1970-01-01
      相关资源
      最近更新 更多