admin管理员组

文章数量:1122846

The source csv file is:

"date_time"
"2024-07-30 19:59:04"

The timezone in fact is GMT+3

I use UpdateRecord with following properties:

Replacement Value Strategy  -> Literal Value
/new_dt                     -> ${date_time.value:toDate():toNumber():minus(3600).format("yyyy-MM-dd HH:mm:ss", "GMT")}

Expected output is:

"new_dt"
"2024-07-30 16:59:04"

but nothing is changed:

"new_dt"
"2024-07-30 19:59:04"

The source csv file is:

"date_time"
"2024-07-30 19:59:04"

The timezone in fact is GMT+3

I use UpdateRecord with following properties:

Replacement Value Strategy  -> Literal Value
/new_dt                     -> ${date_time.value:toDate():toNumber():minus(3600).format("yyyy-MM-dd HH:mm:ss", "GMT")}

Expected output is:

"new_dt"
"2024-07-30 16:59:04"

but nothing is changed:

"new_dt"
"2024-07-30 19:59:04"
Share Improve this question edited Nov 25, 2024 at 21:12 Barbaros Özhan 64.8k11 gold badges35 silver badges61 bronze badges asked Nov 22, 2024 at 14:51 JellyJelly 1,2963 gold badges25 silver badges58 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Use an UpdateRecord:

  • Replacement Value Strategy: Record Path Value
  • /new_dt: format( toDate( /date_time, "yyyy-MM-dd HH:mm:ss", "GMT+3:00"), "yyyy-MM-dd HH:mm:ss", "GMT")

input

"date_time"
"2024-07-30 19:59:04"

output

date_time;new_dt
2024-07-30 19:59:04;2024-07-30 16:59:04

本文标签: Apache Nifi update timezone in RecordStack Overflow