cancel
Showing results for 
Search instead for 
Did you mean: 

Date Time Format

Former Member
0 Kudos

Hi Experts;

I want my date in the output in this format <b>yyyy-MM-dd HH:mm:ss.sss</b> .

This i think is not possible using standard functionality in graphical mapping.

How to do this.

Its quite urgent.Please help

Arjun Ghate

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ;

Try this out

This is a UDF .

java.util.Date d = new java.util.Date();

java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

return f.format(d) ;

Mudit

Former Member
0 Kudos

Thanks it worked .

Answers (2)

Answers (2)

Shabarish_Nair
Active Contributor
0 Kudos

use this java code in a UDF;

Date now1 = new Date();

SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss.sss");

String dateString = formatter.format(now1);

return dateString;

ref: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html

Former Member
0 Kudos

Hi Arjun,

in graphical mapping take source node field........take date function and double click it......change its format to yyyy-MM-dd HH:mm:ss.sss ..........then take it to target node.......

Thanks,

Rajeev Gupta

Former Member
0 Kudos

Hi;

Tried this but we can take yyyy-MM-dd HH:mm:ss and not yyyy-MM-dd HH:mm:ss.sss using this.

Arjun