
Anonymous
Not applicable
2009-05-08
05:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to convert 12 Hour Time to 24 Hour Time date
I have a text file that has a string column with a datetime formatted as "MM/dd/yyyy HH:mm:ss aa" or "02/18/2009 03:30:00 AM"
I am trying to extract the Time and convert it to a 24 Hour Date field.
So far in Tmap I have used the following syntax to extract the time data as a date field but it is still in a 12 hour format. Is there any way to convert it to 24 hour format?
I am trying to extract the Time and convert it to a 24 Hour Date field.
So far in Tmap I have used the following syntax to extract the time data as a date field but it is still in a 12 hour format. Is there any way to convert it to 24 hour format?
TalendDate.parseDate("HH:mm:ss aa",TalendDate.formatDate("HH:mm:ss aa",TalendDate.parseDate("MM/dd/yyyy HH:mm:ss aa",row2.Last_Connect)))
830 Views
9 Replies

Anonymous
Not applicable
2009-05-08
06:51 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I got this to work :-
Input column - 'Date' datatype
Input column date pattern = "MM/dd/yyyy hh:mm:ss a"
Input value = 02/18/2009 11:30:00 PM
tMap expression variable var1 - 'Date' datatype
Output column - 'Date' datatype
Output column date pattern = "MM/dd/yyyy HH:mm:ss"
Output value = 02/18/2009 23:30:00
HTH
I got this to work :-
Input column - 'Date' datatype
Input column date pattern = "MM/dd/yyyy hh:mm:ss a"
Input value = 02/18/2009 11:30:00 PM
tMap expression variable var1 - 'Date' datatype
Output column - 'Date' datatype
Output column date pattern = "MM/dd/yyyy HH:mm:ss"
Output value = 02/18/2009 23:30:00
HTH
830 Views

Anonymous
Not applicable
2009-05-11
03:19 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks but when the input data type is String this does not seem to work. Any other suggestions?
830 Views

Anonymous
Not applicable
2009-05-11
03:59 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems that no matter what I try use Talend.ParseDate against a STRING in the format of "MM/dd/yyyy HH:mm:ss aa" or "2/12/2009 02:12:00 PM" it converts the date to AM.
I have tried this numerous ways. Am I missing something?
I have tried this numerous ways. Am I missing something?
TalendDate.parseDate("MM/dd/yyyy HH:mm:ss aa",row2.Last_Connect)
830 Views

Anonymous
Not applicable
2009-05-11
04:59 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Try :-
Input column - 'String' datatype
Input value = 02/18/2009 11:30:00 PM
tMap expression variable var1 - 'Date' datatype
Expression = new Date(row2.Last_Connect)
Output column - 'Date' datatype
Output column date pattern = "MM/dd/yyyy HH:mm:ss"
Output value = 02/18/2009 23:30:00
Try :-
Input column - 'String' datatype
Input value = 02/18/2009 11:30:00 PM
tMap expression variable var1 - 'Date' datatype
Expression = new Date(row2.Last_Connect)
Output column - 'Date' datatype
Output column date pattern = "MM/dd/yyyy HH:mm:ss"
Output value = 02/18/2009 23:30:00
830 Views

Anonymous
Not applicable
2009-05-11
05:09 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Works Great!
830 Views

Anonymous
Not applicable
2015-04-22
07:01 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TalendDate.getPartOfDate("HOUR",TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",TalendDate.formatDate("yyyy-MM-dd hh:mm:ss",row1.HOUR)))
can anyone help me out please what wrong in this code, i am trying to fetch 24hrs day format from the above code.
can anyone help me out please what wrong in this code, i am trying to fetch 24hrs day format from the above code.
830 Views

Anonymous
Not applicable
2015-04-22
07:05 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My output looks like 0 to 12 here is in below , my requirement is the HOUR column have to be 0 to 24 like minutes 0 to 59.
I am new to Talend and i did not find any documentation forum how to convert the time format to 24 hrs
I am new to Talend and i did not find any documentation forum how to convert the time format to 24 hrs
830 Views

Anonymous
Not applicable
2015-04-26
10:52 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi srikant.panda57,
Could you please give us your input column? Is it "Date" type?
Elaborating your case with an example with input and expected output values will be preferred.
The method should be: TalendDate.getPartOfDate(String, Date):int
Best regards
Sabrina
TalendDate.getPartOfDate("HOUR",TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",TalendDate.formatDate("yyyy-MM-dd hh:mm:ss",row1.HOUR)))
Could you please give us your input column? Is it "Date" type?
Elaborating your case with an example with input and expected output values will be preferred.
The method should be: TalendDate.getPartOfDate(String, Date):int
Best regards
Sabrina
830 Views

Anonymous
Not applicable
2015-12-22
02:51 PM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Geeks,
Please help I am struggling , new to talend
I have a input string as utcStartTime which has a value 1443696342801
I want to convert this into date
something like this : 01-01-1970 11:52:39
tried many things
new java.util.Date(Long)(row1.HIREDATEe*1000))
but still unable to do so
PLease helppp me
many thanks
Please help I am struggling , new to talend
I have a input string as utcStartTime which has a value 1443696342801
I want to convert this into date
something like this : 01-01-1970 11:52:39
tried many things
new java.util.Date(Long)(row1.HIREDATEe*1000))
but still unable to do so
PLease helppp me
many thanks
830 Views
