Difficulty displaying date as dd-MM-yyyy in jsp using jdeveloper [SOLVED]

Hi there,
I have searched through these forums and can't find anyone with the same problem as I am having (probably because I'm just being really dumb).
All I want to do is generate today's date and use this value in a html:text box on a .jsp page.
I can get the date in the form of: Tue Aug 21 15:50:47 BST 2007 by using <% String currdate = new java.util.Date().toString();%> But I can't change the date format to just display 21-08-2007.
I know this is going to be something completely simple but I am really new to this and struggling hard.
I have tried: <% String currdate = new java.text.SimpleDateFormat("ddMMyyyy").toString(); %> but this just returns: java.text.SimpleDateFormat@c5bfbc60.
Many thanks for taking your time to read this I hope you can help me.
Ben Sayers
Message was edited by:
BenSayers

This could do it:
<% String currdate = new java.text.SimpleDateFormat("ddMMyyyy").format( new java.util.Date() ); %> Sascha

Similar Messages

  • How to display date in dd-mon-yyyy hh:mm am/pm format

    Hi,
    I want to display date in dd-mon-yyyy hh:mm format in OA Page. Can any body pls give me sample code that i can write in the controller.
    Regards,
    Ram

    The date format in OAF Pages is controlled by profile ICX: Date format mask.This profile can be set at site as well as user level for the individual users to set the Date format.
    But I would advice not to go for setting different profile values at user level, because i remember some old threads, where seeded Oracle pages fail, as code their is not generalised to handle date formats.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to display the data in XML files into JSP using Jdeveloper.

    Hi All,
    I have two XML files one XML file has the view names and the other has the table names of a particular views, how to display the data in JSP using JDeveloper where when i click a particular view the list of tables of that particular view from XML file two should be displayed in JSP Page.
    Are there any reference documents, regarding the above process please can anyone guide through how to do it.

    Let the servlet ask your business tier to provide the data, then stuff it into beans, and pack those into the Session instance. Then forward the request to the JSP, let the JSP get those beans and display them.

  • Displaying date in dd/MM/yyyy format

    Hi all,
    I am having one date field .To display the date in correct format, I created a dictionary simple type of type date and entered dd/MM/yyyy in representation tab.
    I was using 2004 and it was working properly. Now I am using 2004s for the same application. The problem is when I am selecting a date , it is showing the date in MM/dd/yyyy format in first time. If I selects the date again, then it will be in dd/MM/yyyy format. How can I make the selection in dd/MM/yyyy in first time itself
    Thanks 
    Fahad Hamsa

    Hi,
       Try this:
    1. Create a simple type in the local dictionary. Call it say, CustomDateType.
    2. Set the built-in type as date.
    3. Go to the representation tab and under "External Representation" set the format to "dd/MM/yyyy".
    4. Create a context value attribute day, CustomDate and set its type to CustomDateType.
    5. Create an inputfield with id say, "DateField" and bind its value property to CustomDate.
    6. Now in your wdDoModifyView() write the following code:
    if(firstTime){
       IWDViewElement e = view.getElement("DateField");
       e.requestFocus();
    Regards,
    Satyajit.

  • Display date in DD.MM.YYYY format

    Hi all,
    In my XML one filed is data-type of date and it is coming in DD-MON-YYYY format,but client wants to see in DD.MM.YYYY format in PDF output.I am trying
    <? format-date:DATE_ISSUED;'DD-MM-YYYY'?> in RTF ,but PDF is still showing in DD-MON-YYYY format.
    Please help me to achieve this.

    You can only format dates when they are in the canonical date format. This format looks like: YYYY-MM-DD HH24:MI:SS.
    You have two options:
    1. adapt the XML generation process to generate the date in the canonical format (YYYY-MM-DD) and use the <?format-date:DATE_ISSUED:'DD.MM.YYYY'?> in the template.
    2. adapt the XML generation process to generate the date in the format of the client (DD.MM.YYYY) and print this directly on your report.
    Regards,
    Kevin

  • Unable to display data no entry in the table without using Model clause

    Hi,
    I've an urgent requirement described below :
    The previously posted Question has been answerted using Model Clause:
    Is there any way out to solve it without using Model clause:
    I've a table named as "sale" consisting of three columns : empno, sale_amt and sale_date.
    (Please ref. The table script with data as given below)
    Now if I execute the query :
    "select trunc(sale_date) sale_date, sum(sale_amt) total_sale from sale group by trunc(sale_date) order by 1"
    then it displays the data for the dates of which there is an entry in that table. But it does not display data for the
    date of which there is no entry in that table.
    If you run the Table script with data in your schema, then u'll see that there is no entry for 28th. Nov. 2009 in
    sale table. Now the above query displays data for rest of the dates as its are in sale table except for 28th. Nov. 2009.
    But I need its presence in the query output with a value of "sale_date" as "28th. Nov. 2009" and that of "total_sale" as
    "0".
    Is there any means to get the result as I require?
    Please help ASAP.
    Thanks in advance.
    Create table script with data:
    CREATE TABLE SALE
    EMPNO NUMBER,
    SALE_AMT NUMBER,
    SALE_DATE DATE
    SET DEFINE OFF;
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('12/01/2009 10:20:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/30/2009 10:21:04', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/29/2009 10:21:05', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/26/2009 10:21:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (100, 1000, TO_DATE('11/25/2009 10:21:07', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 5000, TO_DATE('11/27/2009 10:23:06', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 4000, TO_DATE('11/29/2009 10:23:08', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 3000, TO_DATE('11/24/2009 10:23:09', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (200, 2000, TO_DATE('11/30/2009 10:23:10', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 7000, TO_DATE('11/24/2009 10:24:19', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 5000, TO_DATE('11/25/2009 10:24:20', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 3000, TO_DATE('11/27/2009 10:24:21', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 2000, TO_DATE('11/29/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into SALE
    (EMPNO, SALE_AMT, SALE_DATE)
    Values
    (300, 1000, TO_DATE('11/30/2009 10:24:22', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Any help will be needful for me
    Regards,

    select sale_date,sum(sale_amt) total_sale
    from
    select empno,0 sale_amt,(sale_date + ao.rn) sale_date
    from
    select empno,sale_amt,sale_date ,(t.nxt_dt - t.sale_date) diff
    from
    select empno
    ,sale_amt,trunc(sale_date) sale_date
    ,trunc(nvl(lead(sale_date) over (partition by 1 order by sale_date),sale_date)) nxt_dt
    from sale
    ) t
    where (t.nxt_dt - t.sale_date) >1
    ) rec,(select rownum rn from user_objects where rownum<=200) ao
    where ao.rn <=(rec.diff-1)
    union all
    select empno,sale_amt,trunc(sale_date) sale_date
    from sale
    group by sale_date
    order by 1;
    ~~~~Guess this will serve the purpose...
    Cheers Arpan

  • How can i display data on tha same page in jsp/servlet

    Hello friend,
    I am storing 50 items in a dataBase. i ve two buttons/links name previous and next. i ve to display 10 items each time in the same page when i click next button and the revrese for previous. through JSP/Servlet.
    Any suggestions will be appreciated.
    chintan anand

    I'm not sure this is the best practice... try to add the item in the arraylist, then when u click next button, add 10 to the counter. subtract if it is a previous button. thats it!
    ex..
    for(int x=counter;x<=arraylist.lenght();x++)
    ....print item here......
    }

  • Data are not showing in a Jsp using link

    i have a Jsp page. in this Jsp page having some links. i want when i click to link of result some data should be display. but it does not displaying. please check the below code.
    Indus.jsp
    <html>
    <head>
    <title>Indus Public School</title>
    </head>
    <body>
    <div align="center"><font size="+3">
    Indus Public School</font>
    </div>
    <table width="700" height="500" border="0" align="left"
    cellspacing="0">
    <td width="150" rowspan="2" valign="top">
    <table width="200" border="0" align="center" cellpadding="5">
    <tr>
    <td height="100" bgcolor="#476bc0">
    <div align="center" class="boldhead"><font size="+1">
    </font></div>
    </td>
    <tr>
    <td height="40" bgcolor="#728DCF">
    <a href="">Profile</a></td>
    </tr>
    <tr>
    <td height="40" bgcolor="#728DCF">
    <a href="" class="smalltext">Staff</a>
    </td>
    </tr>
    <tr>
    <td height="40" bgcolor="#728DCF">
    <a href="indus.jsp?value=result" class="smalltext">Result</a></td>
    </tr>
    <%String value="";
    if(value!=null && (value.equals("result")))
    {%>
    <h1>Indus Public School </h1>
    <%
    %>
    </body>
    </html>  please suggest.
    Edited by: vijayservices on Mar 11, 2010 12:36 PM

    I guess that You'd like to pass a value in a request. If so You have to pull out this value from request and then make the comparison:
    <%String value=request.getParameter("value");
    if(value!=null && (value.equals("result")))
    {%>
    <h1>Indus Public School </h1>
    <%
    %>In your code You're always comparing an empty value (empty string) as it is declared.

  • Display data as a tree view on IE5

    I want to display data which is parsered by .xsql and use .xsl transfrom to HTML as a tree view(using javascript).
    Is there any sample or suggestion will eb grateful.
    Regards,
    Kelly

    Thanks for the backup :-)
    A new version of the Tree Tag will be out some time this summer, by the way. It features:
    1) The possibility to attach an object to a tree node (getObject(), setObject(...)).
    This means you can display more information in the tree than just what is available
    on the tree node itself. The information in this attached object can also be displayed.
    This attached object can for instance be rendered by Struts's <bean:write ...> tags
    2) Client side event listeners.
    A new tag will be added that will only evaluate it's body when a node is expanded, collapsed,
    selected or unselected. This way you can have a small bit of javascript sent along with the tree html to the browser, when a node is expanded/collapsed or selected/unselected, that for instance reloads the page in another frame in the browser
    3) The <tree:tree...> tag will be able to detect selected/unselected nodes by itself, if the select request is sent to the page containing the <tree:tree tag>. In the current version only expands/collapses are detected automatically. This new feature is implemented to support the client side event listeners.
    4) Someone asked for no-arg contructors of the TreeNode for use with reflection. They will be added to.
    A larger, more detailed manual will probably also be available for a small fee, in addition to the free basic user guide and the free web app. example.
    Look out for it ;-)
    Jakob Jenkov
    http://www.jenkov.com

  • Displaying dates as column headers for BEx Query

    Hi all,
    I have to display dates in sequence as descriptions for 15 columns based on the keyed in date in Bex Query Analyser. I'm able to display date as column heading for one column using text variable with replacement path.I could not able to increment date for other descriptions.Could you please help me to solve this issue.
    Ex: Input Date 05/09/2007 then in the out put column headers should be 0509 0609    0709   ............ 1909
    These are only column headers, values for the columns are quantities calculated using formulas.
    It is urgent.
    Thanks in advance.
    Regards,
    Mandadi.

    hi mandadi,
    if u want dates as headers only then u should use a text variable .
    as a rule u can not set off set for text variable so u create restricted key figure with date restricted and set off set.
    now u use this rkf to populate the text variable using replacement path.
    text variable can use replacement path for replacing from any variable and characteristics.
    bye

  • Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher

    Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher where date should be displayed as date only not string.

    I've tried to use hierarchy node variables, but it seems like you can't specify a attribute of the hierarchy such as level.  So with the WBS hierarchy, if you create a hierarchy node variable, you specify the WBS value to select (If I understand this correctly).  I wish I could instead specify "give me all the WBS nodes that happen to have the value of the level attribute greater or equal to 3.  If I understand Juergens post, he is saying make security access so that only certain WBS levels can be returned in the query.  I suppose we can try that, but that would then preclude getting the level 1 and 2 in the future if the authorization is global.

  • To Display Date format YYYY/MM/DD in Report

    Hi All,
    I wrote start routine code for field Document Date(ZDOC_DATE) to display date format YYYY/MM/DD ,but it displaying as 20090212.But my requirement is the date format should display 2009/02/12.
    Please find the below code which i have written,
    data : v_month(2) type n,
           v_year(4) type n,
           v_day(2) type n,
           v_Doc_Date(8) type c.
           v_month = ITAB-DOC_DATE+4(2).
           v_year = ITAB-DOC_DATE+0(4).
           v_day = ITAB-DOC_DATE+6(2).
           concatenate v_year v_month v_day into v_Doc_Date.
    result value of the routine
      RESULT = v_Doc_Date.
    Can any one please suggest  to display the date format as 2009/02/12.
    Thanks in advance
    karuna.

    Hi Rathy,
    As per your suggestion i have changed the document date lenght 10 & changed code ,the issue has been resolved now..date format showing 2009/03/22.
    data : v_month(2) type n,
    v_year(4) type n,
    v_day(2) type n,
    v_Doc_Date(10) type c.
    v_month = ITAB-DOC_DATE+4(2).
    v_year = ITAB-DOC_DATE+0(4).
    v_day = ITAB-DOC_DATE+6(2).
    concatenate v_year '/' v_month '/' v_day into v_Doc_Date.
    condense v_Doc_Date.
    result value of the routine
    RESULT = v_Doc_Date.
    Thanks for your quick response.
    Thanks to all.
    karuna

  • Display as Date Picker (DD-MON-YYYY)

    Hi everyone,
    can you please help me:
    I want to change an item as Display as Date Picker (DD.MM.YYYY). I cannot find this mask.
    Can you help me to change or can you tell me, where i could find an example?
    Tahnk you and best regards
    Siegwin

    Note that changing the format of a Date Picker does not change the default database input/output date format. Meaning, the NLS_DATE_FORMAT (the default format used when selecting from, or writing to, the Oracle database) does not change when the date picker is changed.
    The date picker format used should match the date format of the application. Meaning that if you retrieve a date from the database into a text field and it found to be in the YYYY-MM-DD format, then the date picker used should be in the YYYY-MM-DD format and if the date retrieved from the database is in the format DD-MON-RR then the Date Picker used should also be in that format.
    The date picker is there to allow dates to be chosen from a calendar in a particular “text” format.
    So, set your date picker to match your NLS DATE FORMAT setting.
    Now, if you want to change the default input/output date format (which is likely your desired effect), then you want to start looking at the NLS settings in your database, the NLS settings in your DAD (reference Marvel.conf), and the NLS settings as they are affected by your Web browser Regional Settings (i.e. Language, territory). If this is the case, refer to the following postings:
    HTMLDB - HOWTO Work with Dates
    Re: HTMLDB - HOWTO Work with Dates
    HTMLDB - HOWTO Work with Dates
    HTMLDB - HOWTO Work with Dates
    YYYY-MM-DD Format for Canada and ISO
    YYYY-MM-DD Format for Canada and ISO

  • Calculating and Displaying Dates in Javascript

    Hello,
    I'm working on a flowchart form for my work, and am having issues getting a date to a) add correctly and b) display only certain portions of the date.
    I have four fields:
    CurrentDate - Displays the Current Date in MM/DD/YYYY format
    DropDownList1 - Contains a list of projects end users can choose from
    TextField1 - Displays text that tells the end user how many days the proejct will take
    DateField1 - Should add the CurrentDate + the Number of days the project will take and return a new date in the same MM/DD/YYYY format
    *Disclaimer* - I am not very experienced with scripting, and chose to go with JavaScript as I do have some previous past experience.
    Here is what I have for my code right now:
    if (DropDownList1.rawValue == 1){
    TextField1.rawValue = "2 Days";
    var AddDate = (Date.valueOf(CurrentDate) + (2*1000*60*60*24));
    DateField1.formattedValue = Date(AddDate);
    else if (DropDownList1.rawValue == 2){
    TextField1.rawValue = "1 Day";
    else if (DropDownList1.rawValue == 3){
    TextField1.rawValue = "2 Days";
    else if (DropDownList1.rawValue == 4){
    TextField1.rawValue = "2 Days";
    else if (DropDownList1.rawValue == 5){
    TextField1.rawValue = "4 Days";
    else if (DropDownList1.rawValue == 6){
    TextField1.rawValue = "5 Days";
    else if (DropDownList1.rawValue == 7){
    TextField1.rawValue = "4 Day";
    The end result is that the TextField1 displays the correct day, but the DateField1 displays a long string of the exact time and date of... well, the time - so no adding takes place. What I need is for the date to be displayed as MM/DD/YYYY. What am I doing wrong? I've only added the calculation to the first "if" statement, and will continue on to the rest once it is functioning.

    The following code will work in a LiveCycle Designer button using the "JavaScript" language option:
    var oNow = new Date(); // get date time object
    console.show(); // oepn and clear the JavaScript console
    console.clear();
    console.println("oNow = " + oNow);
    console.println("oNow.getFullYear() = " + oNow.getFullYear());
    console.println("oNow.getMonth() = " + oNow.getMonth());
    console.println("oNow.getDate() = " + oNow.getDate());
    console.println("oNow.getDay() = " + oNow.getDay());
    console.println("oNow.getHours() = " + oNow.getHours());
    console.println("oNow.getMinutes() = " + oNow.getMinutes());
    console.println("oNow.getSeconds() = " + oNow.getSeconds());
    console.println("oNow.getTimezoneOffset() = " + oNow.getTimezoneOffset());
    The following script uses FormCalc and can be used with a button for testing:
    var oDate = Date() // get today's date
    var Year = Num2Date(oDate, "YYYY") // get year four digits
    var Month = Num2Date(oDate, "MM") // get month 2 digits with leading zero
    var Date = Num2Date(oDate, "D") // get date without leading zero
    xfa.host.messageBox( Concat("oDate: ", oDate, " Year: ", Year, " Month: ", Month, " Date: ", Date) )
    var MyDate = "Feb 23, 2008" // a string data
    var Year = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "YY" ) // 2 digit year
    var Month = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "M" ) // month without leading zero
    var Date = Num2Date( Date2Num(MyDate, "MMM D, YYYY"), "DD" ) // day with leading zero
    xfa.host.messageBox( Concat("MyDate: ", MyDate, " Year: ", Year, " Month: ", Month, " Date: ", Date) )

  • Issue in displaying DATE field in Excel sheet

    Hi All,
    Kindly help me with the below issue:
    A report program when exexuted fetches the data's from database tables and populates in to an itab and the same is then moved to a itab which is declared like this:
    DATA: BEGIN OF t_downd OCCURS 0,
            line(4096) TYPE c,
          END OF t_downd.
    This T_DOWND will have all the obtained records and the same is used to pass the entries to GUI_DOWNLOAD function module inorder to save the excel sheet in '.csv' format to the desktop.
    The issue is the user wants the 'DATE' field to be displayed in 'DD-MM-YYYY' format in the excel sheet. So I have fetched the date based on the position(fdpos) and used the concatenate statement separated by '-'. Now when I run the program, some dates are not getting displayed in 'DD-MM-YYYY' format and some dates are getting displayed correctly as per the requirement.
    While debugging also, I could find the date value in T_DOWND in the 'DD-MM-YYYY' format only. Not sure where it is actually getting changed and why.
    Can some one please provide a soultion for this.
    Thanks,
    Deepa

    Hi Soumya,
    Thanks for the reply!
    I declared a constant in the below format for the quotes:
    constants : c_quotes type c value ''''. (i have put 4 quotes)
    Now i have concatenated the above quotes to my date value.
    But the output in the excel sheet is now getting displayed like this '30-02-2011
    All the dates are getting displayed in the correct expected format, but the only issue is we are getting an extra quotes in front of the date.
    Can you please suggest why this is happening.
    Thanks,
    Deepa
    Edited by: Deeparani.D on Jan 9, 2012 11:53 AM
    Edited by: Deeparani.D on Jan 9, 2012 11:54 AM

Maybe you are looking for

  • I'm Emigrating from the UK to New Zealand and don't want to lose my stuff.

    Hey all, I'm emigrating to New Zealand on Monday (I've left it late, I know), and I have an iPad 2 and an iPhone which I intend to basically use as an iPod Touch for the forseeable future. I've downloaded hundereds of apps, lots of music and some vid

  • Problem with Copy To/Browse for Folder

    Don't know when it started doing this, but now when I right-click and select Copy To and select Browse for Folder it only shows me folders that are under my W7 user name. I need to get to my external drive, but it doesn't display Computer. Strange an

  • Possible SQL Developer 3.0.04 bug

    I'm currently using SQL Developer 3.0.04, using Windows XP, and connecting to an Oracle XE 10g database. I've noticed a strange problem when I export a database and use the default "export all data from all tables" option. Basically, when the rows wi

  • Applet compiles but does not appear...

    the applet compiles but does not appear :( all that appears is a blank box...hopefully someone can help import java.awt.*; import java.applet.*; import java.awt.event.*; public class program2 extends Applet implements ActionListener      private Butt

  • Page will not load

    For two days I have tried to access Mozilla Firefox as my browser. The page will not load.