on 11-14-2007 5:44 AM
Hi all,
i need some java code to get date of second sunday in march and first sunday in november of every year.
this is very urgent
plz help
thanks in advance
jhansi
Jhansi,
Please find the below code. I made the code on assumption each and every time you will get only <b>YEAR</b> as the input.
<b>UDF1 -November Calculation </b>
int a =Integer.parseInt("2008");
GregorianCalendar gc1 = new GregorianCalendar(a,2,1);
Calendar cal = Calendar.getInstance();
cal.setTime(gc1.getTime());
int d= cal.get(Calendar.DAY_OF_WEEK);
int fin;
if(d==1)
{
fin=1;
}
else
{
fin = (7-d)+2;
}
String ret_date = a+"-Nov-"+fin;
return ""+ret_date+"";
<b>UDF2- March Calculation</b>
int a =Integer.parseInt("2008");
GregorianCalendar gc1 = new GregorianCalendar(a,10,1);
Calendar cal = Calendar.getInstance();
cal.setTime(gc1.getTime());
int d= cal.get(Calendar.DAY_OF_WEEK);
int fin;
if(d==1)
{
fin=8;
}
else
{
fin = (7-d)+9;
}
String ret_date = a+"-Mar-"+fin;
return ""+ret_date+"";
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Use this
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html#DAY_OF_WEEK
for complete reference.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check below links for UDF's.
UDF
http://flickr.com/photos/8764045@N06/
Example 1
http://www.flickr.com/photo_zoom.gne?id=544183191&size=o
http://www.flickr.com/photo_zoom.gne?id=544183195&size=o
http://www.flickr.com/photo_zoom.gne?id=544183225&size=o
http://www.flickr.com/photo_zoom.gne?id=544183233&size=o
Example 2
http://www.flickr.com/photo_zoom.gne?id=545133789&size=o
http://www.flickr.com/photo_zoom.gne?id=545133791&size=o
http://www.flickr.com/photo_zoom.gne?id=545133801&size=o
http://www.flickr.com/photo_zoom.gne?id=545133807&size=o
http://www.flickr.com/photo_zoom.gne?id=545133811&size=o
http://www.flickr.com/photo_zoom.gne?id=545138911&size=o
http://www.flickr.com/photo_zoom.gne?id=545138913&size=o
http://www.flickr.com/photo_zoom.gne?id=545138915&size=o
http://www.flickr.com/photo_zoom.gne?id=545138917&size=o
http://www.flickr.com/photo_zoom.gne?id=545138947&size=o
http://www.flickr.com/photo_zoom.gne?id=545138951&size=o
http://www.flickr.com/photo_zoom.gne?id=545005958&size=o
Example 3
http://www.flickr.com/photo_zoom.gne?id=549186611&size=o
http://www.flickr.com/photo_zoom.gne?id=549186651&size=o
http://java.sun.com/j2se/1.5.0/docs/api/
/people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
/people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio
http://help.sap.com/bp_bpmv130/Documentation/Operation/MappingXI30.pdf
Regards,
Phani
Reward Points if Helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jhansi,
This should help..
public static String date() {
Calendar c = Calendar.getInstance();
String dtl = "" + c.get(Calendar.YEAR) + "_" +
(c.get(Calendar.MONTH) + 1)+ "_" +
c.get(Calendar.DATE) + "_" +
c.get(Calendar.HOUR) + "_" +
c.get(Calendar.MINUTE) + "_" +
c.get(Calendar.SECOND);
System.out.println(dtl);
return dtl;
}
this will return a formatted current ..date..if you are looking for a specific date...this is what i suggest, retrieve the date and check to make sure it is the second sunday in march..so set a boolean variable here..and if true then return the date...
Regards
Ravi Raman
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.