You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Camel XML中为Exchange Header设置纽约时区的昨日日期时间?

Solution to Set 24-Hour Prior Date/Time in Camel Exchange Header

Got it, let's tweak your Camel XML code to set the date/time 24 hours before the current time (still using New York's GMT-5 timezone) into the order_creation_date header.

Here's the modified working code:

<setHeader headerName="order_creation_date">
    <simple resultType="java.lang.String">
        ${date-with-timezone:now.minus(24, "hours"):GMT-5:MM-dd-yyyy HH:mm:ss}
    </simple>
</setHeader>

Quick Breakdown of the Change:

  • The core adjustment is swapping now with now.minus(24, "hours") — this uses Camel Simple language's built-in date arithmetic to subtract a full 24-hour interval from the current moment.
  • We retain your original timezone (GMT-5) and date format (MM-dd-yyyy HH:mm:ss) so the output structure stays consistent with your initial setup.

This will populate the order_creation_date header with the exact datetime that occurred 24 hours prior to the current time, properly formatted for the New York timezone.

内容的提问来源于stack exchange,提问作者Shubham Mehta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:46:55