on 12-15-2006 10:30 AM
Hi all,
I want to add <b>time stamp</b> to a date field in my mapping. I want the time in <b>12 hours format</b> and I want to append AM or PM depending on the time of the day. Is there any way to do this <b>without writing an UDF</b>?
Thanks in advance.
Regards,
Divija.
Divija,
Without a UDF, I dont think this is possible.
Reason you would need to get the System time and this can be got using an UDF only.!
Get the system time and do the corresponding logis for the same.
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
please let's try to avoid posting twice the same response without giving any further value, so the thread will not loose it's usefulness
Kind Regards,
Sergio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
I found a way to solve it, but not without the use of an UDF. I am just sharing the UDF written by me:
public void getProperTime(String[] time,ResultList result,Container container){
String strDestTime = " ";
String strTempTime = " ";
String strTempTime1 = " ";
int intTime = 0;
if (time!=null)
{
strTempTime = time[0].substring(1,3);
strTempTime1 = time[0].substring(3);
intTime = Integer.parseInt(strTempTime);
}
if(intTime<12)
{
if (intTime<10)
{
strTempTime = "0"+intTime;
}
else
{
strTempTime = ""+intTime;
}
strDestTime = strTempTime + strTempTime1 +"AM";
}
else
{
intTime =intTime - 12;
if (intTime<10)
{
strTempTime = "0"+intTime;
}
else
{
strTempTime = ""+intTime;
}
strDestTime = strTempTime + strTempTime1 +"PM";
}
result.addValue(strDestTime);
}
Prabhu and Chaku: Can u tell me what changes have to be made in the properties of the current date?
Regards,
Divija.
Hi Divija,
happy you solved your problem.
Have you been able to solve it using <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a> patterns (hh:mm a) or did you find another solution?
Kind Regards,
Sergio
PS: Don't forget to close this thread if you consider the problem solved
You can use the date transformation in mapping program where you can set the properties on how the target value shoud appear.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes it is possible without an UDF. You need to do the setting in the node DATE TRANSFORMATION of the graphical mapping.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Divija,
U can do it..
Just create one time field in target structure andd assign the time in mapping to that filed and use it in receiver adapter.
Venu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Divija,
yes, you can do it using Current Date and specifing <b>hh:mm a</b> as the format.
You can use this format as well with DateTrans block if you need to translate a date and not to get a timestamp.
Have a look at this java doc, it could help: <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html">Class SimpleDateFormat</a>
Hope this solve your problem
Kind Regards,
Sergio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Divija,
You have no other option for this except going for UDF.
Also going for UDF would reduce the complexity too.
Regards
Madhu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Divija,
I think you need to go for an UDF only....
Cheers,
Himadri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.