From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

Get hours in 24h from date

Highlighted
Six Stars

Get hours in 24h from date

Dear experts, 

 

I would get hours from a date with is in this format : '2016-01-02 16:20:25.693'

In my case it's return 4 insted of 16.

 

In my tmap I've written for my field Heure  

Integer.parseInt(routines.TalendDate.formatDate("hh",row2.date_heure)) 

 

input

name : date_heure

format : date

values : 2016-01-02 16:20:25.693

 

output

name : heure

format : integer

values desired : 16 

 

Thank you for your help. Best regards.


Accepted Solutions
Highlighted
Sixteen Stars
Sixteen Stars

Re: Get hours in 24h from date

Hi,
Try to replace "hh" by "HH"'
Integer.parseInt(routines.TalendDate.formatDate("HH",row2.date_heure))

TRF

View solution in original post


All Replies
Highlighted
Sixteen Stars
Sixteen Stars

Re: Get hours in 24h from date

Hi,
Try to replace "hh" by "HH"'
Integer.parseInt(routines.TalendDate.formatDate("HH",row2.date_heure))

TRF

View solution in original post

Highlighted
Six Stars

Re: Get hours in 24h from date

Dear TRF, thank you for your help. 

 

 

Perfect, it's works ! 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog