cancel
Showing results for 
Search instead for 
Did you mean: 

Date and Time Format

Former Member
0 Kudos

Hi All,

While mapping i need the value into field with

yyyy-mm-dd-hh.mm.ss.mmmmm format. I tried in currentDate function having the format of yyyy-mm-dd hh-mm-ss But how to get mmmmm value and How I can set . (DOT) as separator. Could you please help me ?

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi,

y face the same problem

i did this:

i use the trans date and a udf to get the time. later i concat it.

here my udf. getTime

//write your code here

Calendar cal = Calendar.getInstance();

String s_hs= "";

String s_min= "";

String s_seg= "";

//check if hour is less than 10. values less than 10 use 1 character --> (1am) t o(01am)

if (cal.get(cal.HOUR) < 10){

s_hs = "0" + String.valueOf(cal.get(cal.HOUR));

}else { s_hs = String.valueOf(cal.get(cal.HOUR));}

//check if min is less than 10. values less than 10 use 1 character --> (8) t o(08)

if (cal.get(cal.MINUTE) < 10){

s_min = "0" + String.valueOf(cal.get(cal.MINUTE));

}else { s_min = String.valueOf(cal.get(cal.MINUTE));}

//check if sec is less than 10. values less than 10 use 1 character --> (6) t o(06)

if (cal.get(cal.SECOND) < 10){

s_seg = "0" + String.valueOf(cal.get(cal.SECOND));

}else { s_seg = String.valueOf(cal.get(cal.SECOND));}

String hora = s_hs + "." +s_min +"." + s_seg;

return hora;

Former Member
0 Kudos

hi,

u can write a udf for this.

and regarding DOT(.) separator..

u can use dateTransformation

there in format of sorce date give the sorce format time

and in TargetFormat give

hh.mm.ss it will work...

by the way from where u want to fill *mmmmm * month or minutes???

Former Member
0 Kudos

Hi Das,

Actually i want to store current date and time into the mapping field. mmmmmm represents the micro seconds. I tried in currnetDate function. i didn't find the micro seconds option. Any help regarding micro seconds ?

Thanks,

Former Member
0 Kudos

hi

you have to write UDF in that you can use the java date format class in that you can find the option of milli seconds also

Thanks & regards

Kunaal