Format SimpleDateFormat
Hi,all
I have a problem with formatting date with SimpleDateFormat.
I need that the date will be of format dd/mm/yyyy hh:mm:ss
With date all is showing fine,I use dd/MM/yyyy ,but if I add
hh:mm:ss instead of right time I give 12:00:00.
What may be the problem?
Regards,
Michael
Message was edited by:
Michael Beilin
Hi Michael,
See this code to dipplay the date input field value.
Put the format you need.
Package
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
Code:-
SimpleDateFormat smpdtFormat =new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String validFr="";
validFr = wdContext.nodeProductDate().getElementAt(0).getAttributeValue("Validfr").toString();
prodElem.setValidFrom(new Date(smpdtFormat.parse(validFr).getTime()));
Regards,
Mithu
Similar Messages
-
Making java.sql.Date dd.mm.yyyy format
Hi,
java.sql.Date format is m/d/yyyy.
I must use dd.mm.yyyy format.
How can it be done?
Thanks.You can use the following line of code to change the date format
SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
String formattedDate = formatter.format(<Ur java.sql.Date instance>);
Edited by: Santhosh Edla on Sep 7, 2009 5:00 PM -
Error when send date format to R3
All,
i want to send date to BAPI , field type sy-datum, i'm using java.sql.Date as reference (yyyy-MM-dd), but error occurs , does anyone know why?Hi Oscar,
First convert your date in the desired format using SimpleDateFormat .
Then set the Date.
SimpleDateFormat smpdtFormat =new SimpleDateFormat("yyyy-MM-dd");
String validFr="";
validFr = wdContext.nodeProductDate().getElementAt(0).getAttributeValue("Validfr").toString();
<node element name>.setValidDate(new Date(smpdtFormat.parse(validFr).getTime()));
Check this Threads.
Re: Problems with java.sql.Date
Re: format SimpleDateFormat
Regards,
Mithu -
Hi,
I need to print date in the following format:
Jan 21, 2007
11:23 AM 21/01/2007
21-01-2007 18:23
Now as per condition of assignment the year, month, day and hour, min, sec all are entered as separate integer values.
my code:
import java.util.*;
import java.text.*;
public class stringToDate
// Integer value of date and time variables
int day=21;
int month = 1;
int year=07;
int hour=18;
int min=23;
int sec=14;
// Converting integer value into date
public void convertIntoDate()
String strTmp= day+"/"+month+"/"+year+" "+hour+":"+min+":"+sec;
System.out.println("String: " + strTmp);
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
try
Date outDate = dateFormat.parse(strTmp);
System.out.println("Converted: " + dateFormat.format(outDate));
catch(Exception e){ System.out.println("Exception: " + e);}
public static void main(String args[]) {
stringToDate dF = new stringToDate();
dF.convertIntoDate();
}Now as per my code i am able to print in the following format:
String: 21/1/7 18:23:14
Converted: 21/01/0007 18:23:14
But if i try to print in other formats it gives me following error message:
Exception: java.text.ParseException: Unparseable date: "21/1/07"
Please help me....vinee wrote:
Hi,
I tried different output format but still i'm facing the same issue
Following the complete code and error message....
import java.util.*;
import java.text.*;
public class stringToDate
// Integer value of date and time variables
int day=21;
int month = 1;
int year=07;
int hour=18;
int min=23;
int sec=14;
// Converting integer value into date
public void convertIntoDate()
DateFormat dateFormat;
Date outDate=null;
String strTmp= day+"/"+month+"/"+year+" "+hour+":"+min+":"+sec;
System.out.println("Entered string for date: " + strTmp);
// Format 01/01/0070 15:24:14
dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
try
outDate = dateFormat.parse(strTmp);
System.out.println("Converted into Date(dd/MM/yyyy HH:mm:ss): " + dateFormat.format(outDate));
catch(Exception e){ System.out.println("Exception in format 1: " + e);}
// Format Jan 21, 2007
dateFormat = new SimpleDateFormat("EEE, MMM d, ''yyyy");
try
outDate = dateFormat.parse(strTmp);
System.out.println("Converted into Date(EEE, MMM d, ''yyyy): " + dateFormat.format(outDate));
catch(Exception fe)
{System.out.println("Exception in format 2: " + fe);}
public static void main(String args[]) {
stringToDate dF = new stringToDate();
dF.convertIntoDate();
}Following is the error message:
Entered string for date: 21/1/7 18:23:14
Converted into Date(dd/MM/yyyy HH:mm:ss): 21/01/0007 18:23:14
Exception in format 2: java.text.ParseException: Unparseable date: "21/1/7 18:23:14"
Now as per the above error message format one is working fine but format 2(// Format Jan 21, 2007) have some issues...kind suggest.
Edited by: vinee on Oct 2, 2008 4:23 AMPlease re-read my last reply.
Once again : see [http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html]
And your:
int year=07; // should be:
int year=2007; -
How do I use setWhereClauseParam for a date parameter?
Hello -
I have a view object with a query like this:
SELECT column1, column2
FROM my_table
WHERE some_date_column = :1
In the code where I set it I have the date supplied (input from the user from a web page) as a String - "09/17/2004".
What kind of Date object should I use to pass to setWhereClauseParam? java.util.Date? java.sql.Date? oracle.jbo.domain.Date?
(Or would it be better to just change the VO query to something like this and just pass the string?
SELECT column1, column2
FROM my_table
WHERE some_date_column = TO_DATE(:1, 'MM/DD/YYYY')
ThanksScott,
I have used the addWhereClause directly with no parameters. I'm sure you could also do this with parameters. I choose to "expose" the where clause with the following method which I added to the ViewObjectImpl. The main function is to format the date from the java.util.Date to the Oracle TO_DATE function.
public void setApprovedDate(Date approvedDate) {
// add where clause with java.util.date formatted to Oracle to_date format
SimpleDateFormat sdf = new SimpleDateFormat ("yyyy MM dd HH:mm:ss");
addWhereClause("WPoliCosts.APPROVED_DATE<=TO_DATE('"+sdf.format(approvedDate)+ "', 'yyyy mm dd hh24:mi:ss')");
executeQuery();
} -
See, here's the thing with dates in java, the way i see it. We used to have Date, but Date wasn't international so we got Calendar. But some things, like SimpleDateFormat, still expect java.util.Date. java.sql.Date is out there somewhere, too. None of them have direct support for date differences (i.e. dateA - dateB = 8 days, or whatever). Now you're probably reading this thinking "Java supports all of this" and you're right. Calendar has a getTime method that returns a Date, and i can just pass THAT to SimpleDateFormat. With a little math, getTimeInMillis can be used to find the difference in two Calendars. But i got to thinking, "There should only be one Date object i need to think about," and since i don't ever have enough to do at work i put one together. I don't know if any of you are going to care enough to use it, mostly i'm just looking for advice on features i should add to it, inefficiencies in the design, stuff that's hard to understand, or whatever.
This is it:
*This catastrophe brought to you by SrA Meyerin.
*Proximo Satis pro administatio.
package awesomedate;
//The following are imported for the toFormattedString(), toUtilDate(), toSQLDate, and toCalendar() methods, respectively.
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import java.sql.*;
import java.util.TimeZone;
*This class is designed to be the ultimate date object. It stores dates accurate to the millisecond, has the ability to do date
*arithmetic (adding/subtracting days/months/whatever), date comparison, and date formatting. Also it can, at will, be used as any
*of the other date objects in the standard java API.
public class AwesomeDate
*Milliseconds from the epoch. This field is where everything starts.
private long millis;
* The current year. This is the only aspect of the current date that is stored in addition to the milliseconds. Everything else
* is calculated as needed.
private int year;
//The following six variables are fairly self explanatory. I'll explain them anyway.
*Milliseconds in one non-leap year. This can be passed to the "adjustDate()" method
* but mostly it is used to make my code more readable.
public final static long MILLIS_IN_YEAR = 31536000000L;
*Milliseconds in one leap year. This can be passed to the "adjustDate()" method
* but mostly it is used to make my code more readable.
public static final long MILLIS_IN_LEAP_YEAR = 31622400000L;
*Milliseconds in one day. This can be passed to the "adjustDate()" method
* but mostly it is used to make my code more readable.
public static final long MILLIS_IN_DAY = 86400000;
*Milliseconds in one hour. This can be passed to the "adjustDate()" method
* but mostly it is used to make my code more readable.
public static final long MILLIS_IN_HOUR = 3600000;
*Milliseconds in one minute. This can be passed to the "adjustDate()" method
* but mostly it is used to make my code more readable.
public static final long MILLIS_IN_MINUTE = 60000;
*Milliseconds in one second. This can be passed to the "adjustDate()" method
* but mostly it is used to make my code more readable.
public static final long MILLIS_IN_SECOND = 1000;
*The number of days in each month.
private int[] daysInMonth = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
*The timezone offset. GMT is 0, and the default, however, CST (where i live), is -6.
private int timeZoneOffset = -6;
*As the name would indicate, this is the number of milliseconds beyond 00:00 of jan 1 of the current year.
private long millisAfterYear;
*Basic constructor. Defaults to the current date and time. Works on Greenwich Mean Time, so it may seem off. To avoid this, multiply
*add your time zone offset * MILLIS_IN_HOUR to the time in milliseconds.
public AwesomeDate()
setTimeInMillis(System.currentTimeMillis());
*Fairly simple constructor. Sets time to the the number of milliseconds passed past the epoch.
public AwesomeDate(long millis)
setTimeInMillis(millis);
*This constructor sets the date to the year/month/day passed.
public AwesomeDate(int year, int month, int day)
setDate(year, month, day);
*This constructor sets the date time to the year/month/day/minute/hour/second passed.
public AwesomeDate(int year, int month, int day, int hour, int minute, int second)
setDate(year, month, day, hour, minute, second);
*When you have the number of milliseconds, the first thing you must calculate is year. Because the number of milliseconds in a
*year may vary, this is also the most difficult to calculate. This is the method that does it, though.
private void setYearAfter1970()
//I don't want to alter the actual number of milliseconds, so i make this variable and perform calculations on it.
long theseMillis = this.millis;
//Start at 1970 (the epoch) and work from there.
year = 1970;
long nextYear = MILLIS_IN_YEAR;
//In this loop i subtract the number of millis in whatever year. The condition is if i have enough millis to make it through
//another year.
while (theseMillis >= nextYear)
if (isLeapYear(year))
theseMillis = theseMillis - MILLIS_IN_LEAP_YEAR;
nextYear = MILLIS_IN_YEAR;
else
theseMillis = theseMillis - MILLIS_IN_YEAR;
if (isLeapYear(year + 1))
nextYear = MILLIS_IN_LEAP_YEAR;
year++;
millisAfterYear = theseMillis;
this.year = year;
*Calculating the year from before 1970 must be done differently. It's pretty much just inverted.
private void setYearBefore1970()
long theseMillis = this.millis;
year = 1970;
long nextYear = MILLIS_IN_YEAR;
while (theseMillis <= 0)
if (isLeapYear(year))
theseMillis = theseMillis + MILLIS_IN_LEAP_YEAR;
nextYear = MILLIS_IN_YEAR;
else
theseMillis = theseMillis + MILLIS_IN_YEAR;
if (isLeapYear(year - 1))
nextYear = MILLIS_IN_LEAP_YEAR;
year--;
millisAfterYear = theseMillis * -1;
this.year = year;
*Just what it sounds like. Pass it the number of milliseconds past the epoch and it will calculate the date based on that.
public void setTimeInMillis(long millis)
this.millis = millis;
if (millis >= 0)
setYearAfter1970();
else
setYearBefore1970();
*Returns the number of milliseconds from the epoch.
public long getTimeInMillis()
return this.millis;
*Returns the current year.
public int getYear()
return this.year;
*Sets the date to 00:00 of Jan 1 of the passed year.
public void setYear(int year)
this.year = year;
long theseMillis = 0;
if (year > 1970)
//Kind of like setYearAfter1970 method, except it's adding instead of subtracting. So actually it's the opposite.
for (int cntr = 1970; cntr < this.year; cntr++)
if (isLeapYear(cntr))
theseMillis = theseMillis + MILLIS_IN_LEAP_YEAR;
else
theseMillis = theseMillis + MILLIS_IN_YEAR;
else
for (int cntr = 1970; cntr > this.year; cntr--)
if (isLeapYear(cntr))
theseMillis = theseMillis - MILLIS_IN_LEAP_YEAR;
else
theseMillis = theseMillis - MILLIS_IN_YEAR;
//On a leap year there are 29 days in February. If not, there's 28.
if (isLeapYear(year))
daysInMonth[1] = 29;
else
daysInMonth[1] = 28;
//This variable helps me calculate denominations of time that are below year.
millisAfterYear = 0;
setTimeInMillis(theseMillis);
*Sets the month to the one that you passed, 0 being January and 11 being December.
public void setMonth(int month)
if (month < 0 || month > 11)
throw new ArrayIndexOutOfBoundsException(month);
long theseMillis = getTimeInMillis();
int days = 0;
setYear(this.year);
if (getTimeInMillis() > 0)
theseMillis = theseMillis - getTimeInMillis();
else
theseMillis = theseMillis + getTimeInMillis();
for (int cntr = 0; cntr < month; cntr++)
days = days + daysInMonth[cntr];
millisAfterYear = days * MILLIS_IN_DAY + 1;
setTimeInMillis(getTimeInMillis() + millisAfterYear);
*Returns the month stored in this object. With this object 0 represents January and 11 represents December.
public int getMonth()
long theseMillis = millisAfterYear;
int cntr = 0;
while (theseMillis > (MILLIS_IN_DAY * daysInMonth[cntr]))
theseMillis = theseMillis - MILLIS_IN_DAY * daysInMonth[cntr];
cntr++;
return cntr;
*Set the day of month to the one passed.
public void setDayOfMonth(int day)
if (day < 1 || day > daysInMonth[getMonth()])
throw new ArrayIndexOutOfBoundsException(day);
setMonth(getMonth());
//Internally, this actually works starting at zero, however to anyone using this class it appears to start at 1. Therefore
//i must subtract one here.
long addMillis = MILLIS_IN_DAY * (day - 1);
millisAfterYear = millisAfterYear + addMillis;
setTimeInMillis(getTimeInMillis() + addMillis + 1);
*Returns the day of month.
public int getDayOfMonth()
int days = (int)(millisAfterYear / MILLIS_IN_DAY);
int cntr = 0;
while (days >= daysInMonth[cntr])
days = days - daysInMonth[cntr];
cntr++;
//Internally this class stores dates starting at zero, but i want it to look like it starts at 1.
return days + 1;
*Sets the time to the currently selected day at the passed hour on the hour. uses 24 hour clock.
public void setHour(int hour)
if (hour < 0 || hour > 23)
throw new ArrayIndexOutOfBoundsException(hour);
setDayOfMonth(getDayOfMonth());
long addMillis = MILLIS_IN_HOUR * hour;
millisAfterYear = millisAfterYear + addMillis;
setTimeInMillis(getTimeInMillis() + addMillis);
*Returns the hour (but not how many minutes past the hour).
public int getHour()
long millisAfterDay = millisAfterYear % MILLIS_IN_DAY;
return (int)(millisAfterDay / MILLIS_IN_HOUR);
*Set the minutes past the hour. Works 0-59.
public void setMinute(int minute)
if (minute < 0 || minute > 59)
throw new ArrayIndexOutOfBoundsException(minute);
setHour(getHour());
long addMillis = MILLIS_IN_MINUTE * minute;
millisAfterYear = millisAfterYear + addMillis;
setTimeInMillis(getTimeInMillis() + addMillis);
*Returns the minutes past the hour, 0-59.
public int getMinute()
long millisAfterHour = millisAfterYear % MILLIS_IN_HOUR;
return (int)(millisAfterHour / MILLIS_IN_MINUTE);
*Sets the seconds past the minute, 0-59.
public void setSecond(int second)
if (second < 0 || second > 59)
throw new ArrayIndexOutOfBoundsException(second);
setMinute(getMinute());
long addMillis = MILLIS_IN_SECOND * second;
millisAfterYear = millisAfterYear + addMillis;
setTimeInMillis(getTimeInMillis() + addMillis);
*Returns the seconds past the minute, 0-59.
public int getSecond()
long millisAfterMinute = millisAfterYear % MILLIS_IN_MINUTE;
return (int)(millisAfterMinute / MILLIS_IN_SECOND);
*The more commonly seen set method of other date objects. Sets the date/time to 00:00 of the year/month/day passed. Convenience method
*for setDate(int year, int month, int day, int hour, int minute, int second).
public void setDate(int year, int month, int day)
setDate(year, month, day, 0 , 0 , 0);
*Sets every date/time field.
public void setDate(int year, int month, int day, int hour, int minute, int second)
setYear(year);
setMonth(month);
setDayOfMonth(day);
setHour(hour);
setMinute(minute);
setSecond(second);
*Returns yes if the stored date is a leap year. A leap year is every year that is divisible by four unless it is divisible by 100
*unless it is also divisible by 400.
public boolean isLeapYear()
return isLeapYear(this.year);
*For internal use. Returns if the passed year meets the criteria for a leap year.
private boolean isLeapYear(int year)
boolean leapYear = false;
if (year % 4 == 0)
if (year % 100 != 0)
leapYear = true;
else if (year % 400 == 0)
leapYear = true;
return leapYear;
*Returns the difference in milliseconds between the time stored in this object and the millis passed to this method.
public long getDifferenceInMillis(long millis)
return getTimeInMillis() - millis;
*Returns the difference in milliseconds between this date and the date passed to this method.
public long getDifferenceInMillis(AwesomeDate otherDate)
return getDifferenceInMillis(otherDate.getTimeInMillis());
*Designed to be a wrapper method for the getDifferenceInMillis method. This method changes millis into years/days/whatever. Pass
*the number of milliseconds you have to convert in the first parameter. The second parameter should be the type of denomination you
*want (year, day, whatever). Use the MILLIS_IN_* fields associated with this object. Also bear in mind when workin with years that
*some years are leap years, so in extreme cases of differences of 365+ years you may gain/lose a year.
public static int toGreaterDenom(long millis, long denom)
return (int)(millis / denom);
* The first argument is how many of whatever (days, months, years, etc.) to add (use negative numbers to subtract). For the second
* argument pass one of the MILLIS_IN_* fields. Thus, to add two hours would be
* <code>
* AwesomeDate.adjustDate(2, AwesomeDate.MILLIS_IN_HOUR);
* </code>
public void adjustDate(int amount, long typeMillis)
setTimeInMillis(this.millis + amount * typeMillis);
*Returns an object of type java.util.Date set to the date/time stored here.
public java.util.Date toUtilDate()
long offset = TimeZone.getDefault().getRawOffset();
return new java.util.Date(getTimeInMillis() + -1 * offset);
// return new java.util.Date(getTimeInMillis());
*Returns an object of type GregorianCalendar set to the date/time stored here.
public GregorianCalendar toGregorianCalendar()
long offset = TimeZone.getDefault().getRawOffset();
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(getTimeInMillis() - offset);
return cal;
*Returns an object of type java.sql.Date set to the date/time stored here.
public java.sql.Date toSQLDate()
long offset = TimeZone.getDefault().getRawOffset();
return new java.sql.Date(getTimeInMillis() - offset);
/** Format the date using the string that you pass. Works just like the SimpleDateFormat object. Infact, it uses one! Heres
*how it works:
*Letter Date or Time Component Presentation Examples <br>
*G Era designator Text AD <br>
*y Year Year 1996; 96 <br>
*M Month in year Month July; Jul; 07<br>
*w Week in year Number 27 <br>
*W Week in month Number 2 <br>
*D Day in year Number 189 <br>
*d Day in month Number 10 <br>
*F Day of week in month Number 2<br>
*E Day in week Text Tuesday; Tue <br>
*a Am/pm marker Text PM <br>
*H Hour in day (0-23) Number 0<br>
*k Hour in day (1-24) Number 24 <br>
*K Hour in am/pm (0-11) Number 0 <br>
*h Hour in am/pm (1-12) Number 12 <br>
*m Minute in hour Number 30 <br>
*s Second in minute Number 55 <br>
*S Millisecond Number 978 <br>
*z Time zone General time zone Pacific Standard Time; PST; GMT-08:00<br>
*Z Time zone RFC 822 time zone -0800 <br>
public String toFormattedString(String format)
SimpleDateFormat formattage = new SimpleDateFormat(format);
return formattage.format(toUtilDate());
*I overrode the toString method. Now it tells everyone how awesome my AwesomeDate is.
public String toString()
String output = "John's Awesome Date!";
output = output + " Millis: " + getTimeInMillis();
output = output + " Year: " + getYear();
output = output + " Month: " + getMonth();
output = output + " Date: " + getDayOfMonth();
output = output + " Time: ";
if (getHour() < 10)
output = output + "0" + getHour();
else
output = output + getHour();
if (getMinute() < 10)
output = output + "0" + getMinute();
else
output = output + getMinute();
output = output + " Seconds: " + getSecond();
return output;
public static void main(String[] psvm)
AwesomeDate blah = new AwesomeDate();
GregorianCalendar blah1 = new GregorianCalendar();
GregorianCalendar blah2 = new GregorianCalendar();
}The reason Callendar is so complicated is that it is trying to solve a very complicated problem.
You don't appear to support leap seconds (of which there can be upto 2 in any time interval)
http://www.timeanddate.com/time/leapseconds.html
Some of your code will not work for large dates very well (seems to iterate over the years). Try using your date class for astronomical or geological calculations. them big numbers will make your code slow at the moment.
You don't seem to support timezones or transitory offsets (BST vs GMT). You most definately don't handle changes to timezone offsets that have occured in the past or historical daylight savings time offsets (they have not always been the same)
The difference between two calendars is a "duration" a duration means nothing unless it is applied to a caledar/date (although you may be able to get away with it if the duration is always stored in millis) -
XML Publisher - OPP log: Output file was found but is zero sized - Deleted
Hi,
I have created one Main template and sub-template is called from it. I am working with Oracle Apps version 12.1.1. XML Source file gets created using rdf file attached to the concurrent program. Now after registering main template with the required concurrent program when i tried to execute it "View Output" button shows XML souce data instead of PDF report which i have called using main template. Log file was showing following error,
Executing request completion options...
Output file size:
33140
------------- 1) PUBLISH -------------
Beginning post-processing of request 3739501 on node ORAAPP13 at 09-AUG-2011 22:16:38.
Post-processing of request 3739501 failed at 09-AUG-2011 22:16:51 with the error message:
One or more post-processing actions failed. Consult the OPP service log for details.
------------- 2) PRINT -------------
Not printing the output of this request because post-processing failed.
Finished executing request completion options.
And the OPP service log has following error, Can anyone guide me to solve this error.
Template code: AERO_INV_MAIN
Template app: XXAV
Language: en
Territory: US
Output type: PDF
[8/9/11 10:16:51 PM] [339827:RT3739501] Output file was found but is zero sized - Deleted
[8/9/11 10:16:51 PM] [UNEXPECTED] [339827:RT3739501] java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(XSLT10gR1.java:611)
at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:239)
at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:182)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:1044)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:997)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:212)
at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1665)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:975)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5936)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3459)
at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3548)
at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:302)
at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:176)
Caused by: java.lang.StackOverflowError
at java.text.DecimalFormat.subformat(DecimalFormat.java:877)
at java.text.DecimalFormat.format(DecimalFormat.java:674)
at java.text.DecimalFormat.format(DecimalFormat.java:608)
at java.text.SimpleDateFormat.zeroPaddingNumber(SimpleDateFormat.java:1203)
at java.text.SimpleDateFormat.subFormat(SimpleDateFormat.java:1142)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:899)
at java.text.SimpleDateFormat.format(SimpleDateFormat.java:869)
at java.text.DateFormat.format(DateFormat.java:316)
at oracle.apps.fnd.security.CallStack.getInstance(CallStack.java:97)
at oracle.apps.fnd.security.DBConnObj.setBorrowingThread(DBConnObj.java:990)
at oracle.apps.fnd.security.DBConnObj.setBorrowingThread(DBConnObj.java:973)
at oracle.apps.fnd.common.Pool.costBasedSelection(Pool.java:1885)
at oracle.apps.fnd.common.Pool.selectObject(Pool.java:1686)
at oracle.apps.fnd.common.Pool.borrowObject(Pool.java:950)
at oracle.apps.fnd.security.DBConnObjPool.borrowObject(DBConnObjPool.java:584)
at oracle.apps.fnd.security.AppsConnectionManager.borrowConnection(AppsConnectionManager.java:330)
at oracle.apps.fnd.common.Context.borrowConnection(Context.java:1719)
at oracle.apps.fnd.common.AppsContext.getPrivateConnectionFinal(AppsContext.java:2314)
at oracle.apps.fnd.common.AppsContext.getPrivateConnection(AppsContext.java:2251)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:2108)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:1918)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:1762)
at oracle.apps.fnd.common.AppsContext.getJDBCConnection(AppsContext.java:1775)
at oracle.apps.fnd.common.Context.getJDBCConnection(Context.java:1453)
at oracle.apps.fnd.cache.GenericCacheLoader.load(GenericCacheLoader.java:170)
at oracle.apps.fnd.profiles.Profiles.getProfileOption(Profiles.java:1500)
at oracle.apps.fnd.profiles.Profiles.getProfile(Profiles.java:362)
at oracle.apps.fnd.profiles.ExtendedProfileStore.getSpecificProfileFromDB(ExtendedProfileStore.java:211)
at oracle.apps.fnd.profiles.ExtendedProfileStore.getSpecificProfile(ExtendedProfileStore.java:171)
at oracle.apps.fnd.profiles.ExtendedProfileStore.getProfile(ExtendedProfileStore.java:148)
at oracle.apps.fnd.common.logging.DebugEventManager.configureUsingDatabaseValues(DebugEventManager.java:1294)
at oracle.apps.fnd.common.logging.DebugEventManager.configureLogging(DebugEventManager.java:1149)
at oracle.apps.fnd.common.logging.DebugEventManager.internalReinit(DebugEventManager.java:1118)
at oracle.apps.fnd.common.logging.DebugEventManager.reInitialize(DebugEventManager.java:1085)
at oracle.apps.fnd.common.logging.DebugEventManager.reInitialize(DebugEventManager.java:1072)
at oracle.apps.fnd.common.AppsLog.reInitialize(AppsLog.java:595)
at oracle.apps.fnd.common.AppsContext.initLog(AppsContext.java:602)
at oracle.apps.fnd.common.AppsContext.initializeContext(AppsContext.java:579)
at oracle.apps.fnd.common.AppsContext.initializeContext(AppsContext.java:533)
at oracle.apps.fnd.common.AppsContext.<init>(AppsContext.java:301)
at oracle.apps.xdo.oa.schema.server.OAURLConnection.getAppsContext(OAURLConnection.java:121)
at oracle.apps.xdo.oa.schema.server.TemplateURLConnection.getInputStream(TemplateURLConnection.java:89)
at java.net.URL.openStream(URL.java:1009)
at oracle.xdo.parser.v2.XMLReader.openURL(XMLReader.java:2353)
at oracle.xdo.parser.v2.XMLReader.pushXMLReader(XMLReader.java:270)
at oracle.xdo.parser.v2.XMLParser.parse(XMLParser.java:256)
at oracle.xdo.parser.v2.XSLBuilder.processIncludeHref(XSLBuilder.java:1045)
at oracle.xdo.parser.v2.XSLBuilder.processImportHref(XSLBuilder.java:984)
at oracle.xdo.parser.v2.XSLBuilder.processImport(XSLBuilder.java:949)
at oracle.xdo.parser.v2.XSLBuilder.startElement(XSLBuilder.java:373)
at oracle.xdo.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1252)
at oracle.xdo.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:338)
at oracle.xdo.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:285)
Regards,
PriyankaAnd metalink note 1100253.1 states that this issue (java.lang.StackOverflowError) might be caused by a too large set of data to be sorted in the layout file. Recommendation is to removed the sort from the layout file and instead sort the data already in the data definition.
regards,
David. -
Print HTML File Without Showing on Screen
Hi Everyone
Is there a way to print a file (in particular, an html file) from a java app without actually displaying the file on the screen.
ie. print from command line.
I am creating an html file from within java app and would like to print it in one step.
Any help would be greatly appreciated.
Thanks
KellyHi,
Heres some code from an app I wrote that prints out text. I've stripped out little sensitive bits.
// Procedure to perform when print button is pressed
void printButton_actionPerformed(ActionEvent e){
int x, y, pageNo = 1, maxPageHeight, textHeight = 0;
Date today = new Date();
String tempLine = new String("");
String tempString = new String();
Graphics pg;
// Create date and time formats
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yy");
SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
// Create date and time strings
currentDate = dateFormatter.format(today);
currentTime = timeFormatter.format(today);
// Turn off double buffering
RepaintManager.currentManager(this).setDoubleBufferingEnabled(false);
// Get a print job
PrintJob printjob = getToolkit().getPrintJob(this, "<printjob name>", null);
if (printjob != null) {
maxPageHeight = printjob.getPageDimension().height-(rowHeight*2);
pg = printjob.getGraphics();
if (pg != null) {
pg.setColor(Color.black);
pg.setFont(new Font("Courier", 0, 10));
// Print header
textHeight = topOfPage;
pg.drawString("Report Date " + currentDate +
" Time " + currentTime + " Page " + pageNo,
30, textHeight);
textHeight += rowHeight;
pg.drawString("File: " + dataFile , 30, textHeight);
// Print errors
textHeight += rowHeight*2;
pg.drawString("Errors", 30, textHeight);
textHeight += rowHeight;
pg.drawString("------", 30, textHeight);
textHeight += rowHeight;
pg.drawString("col1 col2 col3 Value Reason",
30, textHeight);
textHeight += rowHeight;
pg.drawString("------------ ---- -------------------- ------------ --------------------",
30, textHeight);
if(errorData != null){
for(x = 0; x < errorData.length; x++){
textHeight += rowHeight;
if(textHeight > maxPageHeight){
pg = nextPage(pg, printjob, ++pageNo);
textHeight = topOfPage + rowHeight*2;
tempLine = "";
for(y=0; y<columnLengths.length; y++){
tempString = errorData[x][y] != null ?
roundLength(errorData[x][y].toString(), columnLengths[y])
: roundLength(" ", columnLengths[y]);
tempLine += tempString + " ";
pg.drawString(tempLine, 30, textHeight);
pg.dispose(); // flush page
printjob.end();
}Hope that helps.
Rob. -
Hi,
I am working on an Oracle database (8.1.6) and I am having problems
with dates and I would appreciate help on the following:
I want to use the format 'DD-MON-YY' for:
(1)displaying date fields from a database table after querying
the records.
(2)inserting dates in a column in a database table. In some cases
the dates would be entered by the user while in others SYSDATE is
to be inserted.
Thanks.
nullThe DateTime Converter converts a date to java.util.Date and uses the DateFormat format. (MMM, d, yyyy)
You may need to do some coding to get the desired format
see http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
and
http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html
John -
I have a string in the format "07/02/2002". I want to convert it into a date. Here's my code
String myDate = "07/02/2002";
Date date = DateFormat.getDateInstance().parse(myDate);
But I got the below exception
java.text.ParseException: Unparseable date: "07/02/2002"
at java.text.DateFormat.parse(DateFormat.java:312)
Do you have any ideas?The easiest way to do this is to use java.text.SimpleDateFormat
import java.text.SimpleDateFormat;
import java.util.Date;
// set up the format
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
// parse
Date datToday = sdf.parse("07/02/2002");Hope this helps. -
Dear All
I am using Java mapping to change the filename dynamically. I am getting follwoing error in my receiver file communication channel.
Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.exception.standard.SAPIllegalArgumentException: The parameter "argument" has the value "remote:///PI/OUTPUT//", so it contains the character "remote:///PI/OUTPUT//" which is not allowed
I am passing follwoing values as file access arguments
Target Directory: /PI/OUTPUT/
File Name Scheme: *
Please let me know why this error is coming as I have no other argument to pass other than this.
Regards
SourabhHi Suraj
I am using Java mapping and not a graphical one
My requirement is to create a flat file without any xml tags. Please see the follwoing code for Java mapping:
public class JMapWorkOrderNRealTime extends DefaultHandler implements StreamTransformation
private Map map;
private OutputStream out;
private Map param;
String lineEnd = System.getProperty("line.separator");
private String Data;
public JMapWorkOrderNRealTime()
public void setParameter(Map map)
param = map;
if(param == null)
param = new HashMap();
public void execute(InputStream in, OutputStream out)throws com.sap.aii.mapping.api.StreamTransformationException
try
//The following is for the FileName in the File Adapter
DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
String MyFileName = dynamicconfiguration.get(key);
MyFileName=MyFileName.substring(0,(MyFileName.length())-15);
// Date format
SimpleDateFormat Sdate = new SimpleDateFormat("yyyyMMddHHmmSS");
String currentdate=Sdate.format(new Date());
//end
MyFileName=MyFileName.concat(".").concat(currentdate);
MyFileName=MyFileName.concat(".BAD");
dynamicconfiguration.put(key, MyFileName);
}catch(Throwable t)
{ t.printStackTrace(); }
try
String line = null;
String lineEnd = System.getProperty("line.separator");
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
while((line=bin.readLine())!=null)
out.write(line.getBytes());
out.write(lineEnd.getBytes());
}catch(Throwable t)
t.printStackTrace(); -
I am taking date from the user in mm/dd/yyyy in the text field.
Since I am maintaing a document management system,
I need to sort docs with respect to dates. Latest date first.
Can anyone help me how do I do this.
I have to get docs from database(mysql) and I cant use order by ....
Please helpHow you enter and what gets stored and what gets displayed are controlled by your formating and can be 3 different things.
If you use an sqldate as a type for the mysql then you have raw date data ( some big integer type). This you push through a format to display.
Calendar work = Calendar.getInstance();
java.sql.Date sqldate = new java.sql.Date(work.getTimeInMillis());String displayDate= sqldate.toString();
gives you todays date in the format yyyy-mm-dd
to use something else see:
http://java.sun.com/docs/books/tutorial/i18n/format/simpleDateFormat.html
In the mySQL dates are stored in a sortable format - how they show is NOT how they are stored.
I have dates in mySQL also, I have to display the records in ascending or descending order depending on the module.
Dates are a bitch to work with. You get it working on your local host and then you up load it to your server and it is running with a different date format and everything crashes.
Just wait till they ask for time, it is even worse.
so basically
1- input your date info
2 - tranfrom it into sql date format
3 store it inmysql as a date
4 search it and generate a datset in order of xdate desc
5 read through the data set and format your date for display
Lena -
How to convert oracle timestamp to java timestamp
Hi,
I need to convert oracle timestamp that i got from oracle database to java timestamp.I tried to use getTimestamp() to get timestamp value from oracle, but am getting NumberFormatException.
Could any of suggest how to convert oracle timestamp to java timestamp.Thanks jverd ,
then my code will be like:
String oracleTS="11-MAR-05 11.19.20.625 AM";
// am looking for yyyy-MM-dd HH:mm:ss format
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss");
Timestamp javaTimestamp=Timestamp.valueOf(oracleTS);
System.out.println("javaTimestamp----->>
"+javaTimestamp);
ving java.lang.NumberFormatException: For input
string: "MAR"Well, the SimpleDateFormat has to actually match the format you're trying to parse, for one thing. Then you have to actually USE the SDF, which you didn't.
You really haven't made it clear what you're trying to do, and it doesn't appear that you bothered to study the links I provided.
DateFormat df = new SimpleDateFormat("dd-MMM-yy HH.mm.ss.SSS aa");
Date date = df.parse(oracleTS);
Timestamp ts = new Timestamp(date.getTime()); -
I wanna convert a date from format yyyy/mm/dd to dd/mm/yyyy
and make this code :
Date v_fd = wdContext.currentContextElement().getV_fechadesde();
Date v_fh = wdContext.currentContextElement().getV_fechahasta();
String v_fechadesde = v_fd.toString();
String v_fechahasta = v_fd.toString();
v_fechadesde = v_fechadesde.substring(8,10) + '-' + v_fechadesde.substring(5,7) + '-' + v_fechadesde.substring(0,4) ;
v_fechahasta = v_fechadesde.substring(8,10) + '-' + v_fechahasta.substring(5,7) + '-' + v_fechahasta.substring(0,4) ;
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
java.util.Date d;
try {
d = dateFormat.parse(v_fechadesde);
dateFormat.applyPattern("dd/MM/yyyy");
v_fechadesde = dateFormat.format(d);
} catch (Exception e) {
e.printStackTrace();
java.sql.Date date = java.sql.Date.valueOf(v_fechadesde);
wdContext.currentZhr_Rfc_Pce_Get_Object_InputElement().setI_Begda(date);
wdContext.currentZhr_Rfc_Pce_Get_Object_InputElement().setI_Endda(date);
example
enter
01-06-2007
result
0006-11-28
Any idea please ?import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MainClass {
public static void main(String[] args) {
String dateIn = "01-06-2007";
String dateIn2 = "1/6/2007";
try {
System.out.println("Test Correct Input:"+convertDate(dateIn));
} catch (Exception e) {
System.out.println(e.getMessage());
try {
System.out.print("Test Wrong Input:");
System.out.println(convertDate(dateIn2));
} catch (Exception e) {
System.out.println(e.getMessage());
* @param inDate
* @return
* @throws Exception
public static String convertDate(String inDate) throws Exception {
String inPattern = "dd-mm-yyyy";
String outPattern = "yyyy-mm-dd";
String dateOut = null ;
SimpleDateFormat dateFormatter = new SimpleDateFormat(inPattern);
Date date = null;
try {
date = dateFormatter.parse(inDate);
} catch (ParseException e) {
throw new Exception("Wrong Format");
SimpleDateFormat formatter = new SimpleDateFormat(outPattern);
dateOut = formatter.format(date);
return dateOut;
If the format is incorrect i.e. not in inPattern : dateFormatter.parse(inDate); throws exception.
Go via links i given in first post. You can have more information on date formats there.
Regards,
Ashwani Kr Sharma -
Hi all, my test.jsp got the "Exception ex" error; however, I don't see any Exception ex in my test.jsp code plus "'}' expected" error. Can any one tell me what's wrong in test.jsp and how to fix it.
Thanks a ton
[05/May/2003:17:23:15] info ( 1276): Internal Info: loading servlet /regionalnews.jsp
[05/May/2003:17:23:16] info ( 1276): JSP: JSP1x compiler threw exception
org.apache.jasper.JasperException: Unable to compile class for JSPC:\iPlanet\Servers\https-sjw1bnguyen01.NA.RTA\config\..\ClassCache\_jsps\_regionalnews_jsp.java:626: 'catch' without 'try'.
} catch (Exception ex) {
^
C:\iPlanet\Servers\https-sjw1bnguyen01.NA.RTA\config\..\ClassCache\_jsps\_regionalnews_jsp.java:637: '}' expected.
^
C:\iPlanet\Servers\https-sjw1bnguyen01.NA.RTA\config\..\ClassCache\_jsps\_regionalnews_jsp.java:638: 'try' without 'catch' or 'finally'.
^
3 errors
at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled Code)
at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.java:252)
at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntity.java:173)
at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:427)
[05/May/2003:17:23:16] warning ( 1276): Internal error: Failed to get GenericServlet. (uri=/regionalnews.jsp,SCRIPT_NAME=/regionalnews.jsp)
Here is my test.jsp file: ********************
<%@ page import = "java.sql.*,oracle.jdbc.driver.*,java.util.Date, java.text.*" %>
<%
String dbUrl = "jdbc:oracle:thin:@sjw1bnguyen01:1521:mydb";
String dbUser = "scott";
String dbPass = "tiger";
//Do the login through database
String queryArtcCatNav = "SELECT DISTINCT CAT_ID FROM ssp01_artc" +
" WHERE RGN_ID " + "= " + "\'" + request.getParameter("RgnId") + "\'" +
" ORDER BY CAT_ID ASC";
String queryArtcYrNav = "SELECT DISTINCT (to_char(ARTC_PUB_DTM, 'YYYY')) as ARTC_PUB_DTM" +
" FROM ssp01_artc" +
" WHERE RGN_ID = " + "\'" + request.getParameter("RgnId") + "\'" +
" ORDER BY ARTC_PUB_DTM DESC";
String queryLatestYr = "SELECT MAX(to_char(ARTC_PUB_DTM, 'YYYY'))FROM ssp01_artc)";
String queryCurYrArtc = "SELECT CAT_ID, RGN_ID, ARTC_FLNM_TRKG_ID, ARTC_HDR_TXT, ARTC_PUB_DTM" +
" FROM ssp01_artc" +
" WHERE to_char(ARTC_PUB_DTM, 'YYYY')" +
" IN (SELECT MAX(to_char(ARTC_PUB_DTM, 'YYYY'))FROM ssp01_artc)" +
" AND RGN_ID = " + "\'" + request.getParameter("RgnId") + "\'" +
" GROUP BY CAT_ID, ARTC_FLNM_TRKG_ID, ARTC_HDR_TXT, ARTC_PUB_DTM" +
" ORDER BY CAT_ID, ARTC_PUB_DTM DESC";
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection(dbUrl, dbUser,dbPass);
Statement st = con.createStatement();
ResultSet rsArtcCatNav = st.executeQuery(queryArtcCatNav);
ResultSet rsArtcYrNav = st.executeQuery(queryArtcYrNav);
ResultSet rsCurYrArtc = st.executeQuery(queryCurYrArtc);
ResultSet rsLatestYr = st.executeQuery(queryLatestYr);
%>
<html>
<head>
<title>Test Page</title>
<table border="0" width="515" cellspacing="0" cellpadding="0">
<tr>
<td>
<h4 align="center"><font color="#000000" face="Verdana, arial"> <br>
<%
if(request.getParameter("RgnId").equals("na")) {
%>
</font><font face="verdana, arial">Semiconductor Press Room
- North America</font></h4>
<% }
else if(request.getParameter("RgnId").equals("eu")) { %>
</font><font face="verdana, arial">Semiconductor Press Room
- Europe</font></h4>
<% } %>
<hr width="515">
<!--- Display corporate news article header --->
<p align="center"><font face="verdana, arial"><b>Corporate News</b></font></a></p>
<!--- Set message flag variable to control the display for warning message --->
<% boolean blnMsgFlg = false; %>
<ul>
<% while(rsCurYrArtc.next()) { %>
<li>
<%
if(rsCurYrArtc.getString("RGN_ID").equals("na") && rsCurYrArtc.getString("CAT_ID").equals("crp")) {
%>
<% blnMsgFlg = true; %>
<li>
<!--- If the region is North America then show the hyperlink with MM/DD/YYYY format
If the region is Europ then show the hyperlink with MM/YYYY format --->
<%
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss.S");
String dateString = rsCurYrArtc.getString("ARTC_PUB_DTM");
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
formatter = new SimpleDateFormat ("MMM d, yyyy");
dateString = formatter.format(currentTime_2); %>
<!-- Call html file -->
<p align="left"><font size="2" face="verdana, arial"><a href="/press/releases/<%= rsCurYrArtc.getString(ARTC_FLNM_TRKG_ID") %">.htm">
<%= dateString %></a> - <%= rsCurYrArtc.getString("ARTC_HDR_TXT") %></p></FONT>
<% } //Region=eu
else if(rsCurYrArtc.getString("RGN_ID").equals("eu") && rsCurYrArtc.getString("CAT_ID").equals("crp")) { %>
<% blnMsgFlg = true; %>
<%
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss.S");
String dateString = rsCurYrArtc.getString("ARTC_PUB_DTM");
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
formatter = new SimpleDateFormat ("MMM, yyyy");
dateString = formatter.format(currentTime_2); %>
<!-- Call html file -->
<p align="left"><font size="2" face="verdana, arial"><A href="/press/releases/<%= rsCurYrArtc.getString("ARTC_FLNM_TRKG_ID") %>.htm">
<%= dateString %></a> - <%= rsCurYrArtc.getString("ARTC_HDR_TXT") %></p></FONT>
</li>
<% } %>
</ul>
<!--- Dispaly the warning message if there is no article --->
<% if(blnMsgFlg) { %>
<p align="center"><font face="verdana, arial" size="2"><b>
No news release for this category.</b></font></a></p>
<% } %>
<hr width="515">
<!--- Display product news article header --->
<p align="center"><font face="verdana, arial"><b>Product News</b></font></a></p>
<!--- Set variable category id counter to control the display of category description under Product News title --->
<% int intCatIdCtr = 0; %>
<!--- Set message flag variable to control the display for warning message --->
<% boolean blnMsgFlg = false; %>
<% while(rsCurYrArtc.next()) { %>
<%
if(rsCurYrArtc.getString("RGN_ID").equals("na") && rsCurYrArtc.getString("CAT_ID") != "crp") {
%>
<% blnMsgFlg = true; %>
<%
if(rsCurYrArtc.getString("CAT_ID") != intCatIdCtr) {
%>
<p align="center"><font face="verdana, arial" size="2"><b><%= rsCurYrArtc.getString("CAT_ID") %></b></font></a></p>
<% intCatIdCtr = rsCurYrArtc.getString("CAT_ID") %>
<% } %>
<ul>
<li>
<!--- If the region is North America then show the hyperlink with MM/DD/YYYY format
If the region is Europ then show the hyperlink with MM/YYYY format --->
<%
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss.S");
String dateString = rsCurYrArtc.getString("ARTC_PUB_DTM");
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
formatter = new SimpleDateFormat ("MMM d, yyyy");
dateString = formatter.format(currentTime_2); %>
<!-- Call html file -->
<p align="left"><font size="2" face="verdana, arial"><A href="/press/releases/<%= rsCurYrArtc.getString("ARTC_FLNM_TRKG_ID") %>.htm">
<%= dateString %></a> - <%= rsCurYrArtc.getString("ARTC_HDR_TXT") %></p></FONT>
<% }
else if(rsCurYrArtc.getString("RGN_ID").equals("eu") && rsCurYrArtc.getString("CAT_ID") != "crp") { %>
<% blnMsgFlg = true ;%>
<%
SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss.S");
String dateString = rsCurYrArtc.getString("ARTC_PUB_DTM");
ParsePosition pos = new ParsePosition(0);
Date currentTime_2 = formatter.parse(dateString, pos);
formatter = new SimpleDateFormat ("MMM, yyyy");
dateString = formatter.format(currentTime_2); %>
<!-- Call html file -->
<p align="left"><font size="2" face="verdana, arial"><A href="/press/releases/<%= rsCurYrArtc.getString("ARTC_FLNM_TRKG_ID") %>.htm">
<%= dateString %></a> - <%= rsCurYrArtc.getString("ARTC_HDR_TXT") %></p></FONT>
</li>
<% } %>
</ul>
<!--- Display the warning message if there is no article --->
<% if(blnMsgFlg) { %>
<p align="center"><font face="verdana, arial" size="2"><b>
No news release is available in the selected category for the selected
year request.getParameter("PubYr"). Please try another year or category</b></font></a></p>
<% } %>
</td>
</tr>
</table>
<% try {
rsArtcCatNav.close();
rsArtcYrNav.close();
rsCurYrArtc.close();
rsLatestYr.close();
st.close();
con.close();
catch
(Exception e) {} %>
</body>
</html></a>hi there,
again, it's pretty hard to see from your code but the exception you get is synthax related. you probably forgot to close one of the if's. if you format your code nicely these would be easier to catch.
ie. i use following format:
if(something)
for(condition)
do something.
notice how easy it is to see where you open and close {}'s.
have a nice day.
cem.
Maybe you are looking for
-
Clear postings after G/L account is changed
Hello, I have a stituation, with a G/L account. In our case, the customer required to have the G/L account enabled for open items. The balance was 0.roed, and we tryed to enable the open items. After setting the error message stated: 'Balace 0 but op
-
I am having problems uploading a photo book from my MacBook Pro!!! I almost complete uploading this 32 page iPhoto book when I get an error message stating "An error occurred uploading your order" This error message has occurred for each of my four a
-
I've just upgraded to Leopard. Every time I play my final cut timeline it crashes. The computer freezes. THe cursor disappears and the only option is to hold the power button. Please help.
-
Swipe left is deleting mail messages even when swipe is disabled
Swipe left is deleting mail messages even when swipe is disabled. I had it set to "Flag", but it was still deleting them so I tried disabling it. It does this only with my Exchange account, not other mail accounts. Running iOS 8.1, but it did it with
-
Add a new SUB to a PUB 8.1.5
I have a a Pub and 3 sub standalone servers all working fine. I am trying to add a 4 sub (have the licence) running on VMWare. The build has gone fine accept for getting the Sub authenicated to the PUB, the sub is defined on the PUB. I am getting the