on 10-22-2007 6:54 AM
Hi all,
We have a requirement where in we have to split the incoming datetime value to date and time and store it in different fields/columns in the database.
Is it possible with message mapping or do we have to use a UDF.
Provide us with a good soln.
Thanks,
Younus
Hi,
if your input( i.e. a) is 12/12/200712:12:12, You use the UDF to split date & time..
return a.substring(10,18);---> Time
return a.substring(0,10);---> Date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi yunus
<b>if want to go by UDF look this code</b>
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) ;
..............................................................
<b>also can use this java code in a UDF;</b>
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
can look at this thread also
Thanks!!!
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use datetrans function to get the output date and time separately from a single source node...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Younus,
It is possible with standard functions only
regard
Ramesh P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Younus,
Suppose DATETIME is your node in source
and DATE and TIME are two different nodes in your target.
Use Node DATETIME -> DateTrans(function) -> DATE , here in DateTrans only extract DATE
Use Node DATETIME -> DateTrans(function) -> TIME, here in DateTrans only extract TIME
Regards
Ramesh P
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.