cancel
Showing results for 
Search instead for 
Did you mean: 

currentDateTime upto millisecs

Former Member
0 Kudos

How do we capture currentDateTime upto milliseconds in graphical mapping???

Thanks in advance!!!

Edited by: SoumenDas2009 on Oct 23, 2009 10:34 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Soumen,

Just go to the current time field and click on format and just add .MMM/.SSS to the current fielsd i hope it ll do do no udf is required as of i tested this recently in p.i 7.1

Former Member
0 Kudos

Apologies for not updating...this query is history,,,,

former_member187339
Active Contributor
0 Kudos

Hi Soumen,

A udf is required for this


String currentDateTime(String dateFormat) {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
    return sdf.format(cal.getTime());
}

import these libraries too

import java.util.Calendar;

import java.text.SimpleDateFormat;

The input dateFormat is the format that you are expecting the result. Some formats

dd MMMMM yyyy

yyyyMMdd

dd.MM.yy

MM/dd/yy

h:mm a

H:mm:ss:SSS

K:mm a,z

yyyy.MMMMM.dd GGG hh:mm aaa

Regards

Suraj