Not showing correct output when parsing the date

//WAP the gives the details of employees
import java.io.*;
import java.util.*;
import java.text.Format;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
class employee
  private String nm,curr_dt;
  private Date dob,doj;
  private int salary;
           employee()
              nm="\0";
              dob=null;
              doj=null;
              curr_dt=null;
              salary=0;
           void getdata()throws IOException
              String dt;
              BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
              //we can create date with these 3 type of objects
              Format fm=new SimpleDateFormat("dd-mm-yyyy");
              DateFormat df=new SimpleDateFormat("dd-mm-yyyy");
   //object of base class are type compatible with the object of derived class
              SimpleDateFormat sdf=new SimpleDateFormat("dd-mm-yyyy");
              System.out.print("\nEnter the name of Employee : ");
              nm=br.readLine();
              try{
              System.out.print("\nEnter the date of birth of Employee : ");
              dt=br.readLine();
              dob=(Date)fm.parseObject(dt);
              System.out.print("\nEnter the date of joining of Employee : ");
              dt=br.readLine();
              doj=df.parse(dt);
              }catch(ParseException e){
              Date d=new Date();
              curr_dt=sdf.format(d);
              System.out.print("\nEnter the salary of employee : ");
              salary=Integer.parseInt(br.readLine());
           void putdata()
              System.out.println("\n\n\nEmployee Name : "+nm);
              System.out.println("\nDate of birth : "+dob);
              System.out.println("\nDate of joining : "+doj);
              System.out.println("\nCurrent date : "+curr_dt);
              /*if((doj-curr_dt)>1)
                   salary+=3000;
              System.out.println("\nSalary of Employee : "+salary);
class emp
  public static void main(String str[])throws IOException
       employee emp[]=new employee[1];
       System.out.println("\nEnter the detail of employees \n\n");
       for(int i=0;i<1;i++)
            emp=new employee();
emp[i].getdata();
System.out.println("\n\nDetail of employees are\n\n");
for(int i=0;i<1;i++)
emp[i].putdata();
}*Output:*
Enter the detail of employees
Enter the name of Employee : Rajendra Sharma
Enter the date of birth of Employee : 10-10-1979
Enter the date of joining of Employee : 05-09-2004
Enter the salary of employee : 2000
*it is not showing date in the "dd-mm-yyyy" format and not showing correct month as well*
Detail of employees are
Employee Name : Rajendra Sharma
Date of birth : Wed Jan 10 00:10:00 IST 1979
Date of joining : Mon Jan 05 00:09:00 IST 2004
Current date : 17-08-2008
Salary of Employee : 2000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Hi,
Use below code that will help u to sort ur problem.
import java.io.*;
import java.util.*;
import java.text.Format;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
class employee
private String nm,curr_dt;
private Date dob,doj;
private int salary;
private String dobb,dojj;
employee()
nm="\0";
dob=null;
doj=null;
curr_dt=null;
salary=0;
void getdata()throws IOException
String dt;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//we can create date with these 3 type of objects
DateFormat fm=new SimpleDateFormat("dd-mm-yyyy");
DateFormat df=new SimpleDateFormat("dd-mm-yyyy");
//object of base class are type compatible with the object of derived class
SimpleDateFormat sdf=new SimpleDateFormat("dd-mm-yyyy");
System.out.print("\nEnter the name of Employee : ");
nm=br.readLine();
try{
System.out.print("\nEnter the date of birth of Employee : ");
dt=br.readLine();
dob=(Date)fm.parseObject(dt);
dobb= fm.format(dob);
System.out.print("\nEnter the date of joining of Employee : ");
dt=br.readLine();
doj=df.parse(dt);
dojj = df.format(doj);
}catch(ParseException e){
Date d=new Date();
curr_dt=sdf.format(d);
System.out.print("\nEnter the salary of employee : ");
salary=Integer.parseInt(br.readLine());
void putdata()
System.out.println("\n\n\nEmployee Name : "+nm);
System.out.println("\nDate of birth : "+dobb);
System.out.println("\nDate of joining : "+dojj);
System.out.println("\nCurrent date : "+curr_dt);
/*if((doj-curr_dt)>1)
salary+=3000;
System.out.println("\nSalary of Employee : "+salary);
class emp
public static void main(String str[])throws IOException
employee emp[]=new employee[1];
System.out.println("\nEnter the detail of employees \n\n");
for(int i=0;i<1;i++)
emp=new employee();
emp[i].getdata();
System.out.println("\n\nDetail of employees are\n\n");
for(int i=0;i<1;i++)
emp[i].putdata();
thanks,
prabhu selvakumar.

Similar Messages

  • Fonts not showing correctly only when on my account page on app store

    fonts not showing correctly only when on my account page on app store

    Firstly, make sure that your device is not hidden (left hand pane). If it just reads device then toggle between SHOW and HIDE.
    Secondly, try all the other ports on your computer, even a number of times.
    Thirdly, if you have another computer try plugging your device into it without taking any action, give it a moment, remove it and try it back in your other computer again.
    Failing all that, see here - http://support.apple.com/kb/TS1538 for Windows and http://support.apple.com/kb/TS1591 for Macs
    And failing all that put the device into Recovery mode. See here and note the paragraph 'If you restore from a different computer.... ' down near the bottom of the page -
    http://www.apple.com/support/ipad/assistant/itunes/

  • Some tags are not showing in SQL when executing the script as per Date

    A) When i am executing below script
    Select ToP 10000 [T_idx],[T_Tag], [T_date], [T_counter] from dbo.[total] ORDER BY T_DATE desc
    i am able to see all tags with respect to date except some tags prefix with ----PO, this 'PO' tags also present in the same table, with same time and date like other tags
    B) When executing below script
    Select top 10000 * FROM dbo.[total] where T_Tag like '%PO%' ORDER BY T_DATE DESC
    i am able to see all tags related to  PO
    How i can all tags including 'PO' with one script. can any one help me ??
    acmi

    Venkat,
    Select ToP 10000 [T_idx],[T_Tag], [T_date], [T_counter] from dbo.[total] ORDER BY T_DATE desc
    The above query MAY or MAY NOT give the records with taag ---PO as they might belong to a later data which might not fit into the top 10,000 dates of the table. This shud be the problem.
    If you want to see all the data irrespective of the number of rows, then below shud help:
    Select
    [T_idx],[T_Tag], [T_date], [T_counter]
    from dbo.[total]
    ORDER BY T_DATE desc
    If you need the rows that CONTAIN --PO then folowing shud do it:
    SELECT
    [T_idx],[T_Tag], [T_date], [T_counter]
    FROM dbo.[total]
    WHERE T_Tag like '%PO%'
    ORDER BY T_DATE desc
    If you need just the top 10,000 rows of the above result, then just add a TOP clause as below:
    SELECT
    TOP 10000
    [T_idx],[T_Tag], [T_date], [T_counter]
    FROM dbo.[total]
    WHERE T_Tag like '%PO%'
    ORDER BY T_DATE desc
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Captivate 5 quiz review not showing correct answers when loaded to LMS

    Hello All. I would really appreciate some help please. Despite the quiz review working correctly when published, i.e. both 'your answer' and 'the correct answer' captions appear in the review, on loading to LMS the review caption does not show the 'the correct answer is' , but instead 'you did not answer this question completely'.
    Any ideas why this should be the case? I've attached screen shots of my quiz preferences for completenes.
    Many thanks in advance.
    Janey

    Do the same modules evidence this behaviour when published and played outside the LMS, e.g. from a web server or on your hard drive?
    If not, it's possible that some setting in the LMS is over-riding what happens at playback.  You could try checking the box under LMS Customisation for Never Send Resume Data and see if that seems to make any difference.  If the LMS is maintaining a record of some previous attempt at the same module then turning off Resume Data might show that up.

  • Not getting any output when running the Webservice through Xacute

    hai all,
    I am using a transaction as web service to be called in another transaction in the same server. I can see the output of the web service in the tracer, when I execute it in the BLS. But if I run the same transaction via xacute query I am not getting any output. I had read in one of the threads that reference document has to be assigned. I tried doing that also, but no luck. Can somebody pls. throw some light on how to use reference document & whether it is required in my case?
    Thanks,
    vidhya

    Hai Rick,
                    thanks for the hint i have used document and row actions now iam gettting output through xacute...
    thanks,
    vidhya.

  • E4200 Status_Router.asp dows not show correctly in Safari on the iPhone

    If I  use Safari on th iPhone and log into the router config
    and navigate to the Status section
    The Status_Router asp does not show any IP information the fields are empty
    From a "real" browser things are fine
    The only way I know if there is an IP is if the DHCP Lease Time
    is showing a expiration/renewal time

    Contact Safari for the IPhone as a 'real browser' displays properly.

  • Zen not showing correct album when correct one is on mp3 f

    I have come to notice that if you have two artists with the same exact album name, all those files will show the album art from the first atrist that comes alpahbetically. So if I have Artist A with album name Album and Artist B which also has the album name Album, when playing a song from Artists B from Album, it will display the album art from the Artist A Album. I hope I made that clear enough. Creative has to change the way the Zen handels album art because this is just not acceptable. I worked very hard to makre sure all my songs have the right album are and the right mp3 tags and then I go and am not able to appriciate my hard work. Does this happen to anyone else?

    dominican44 wrote:
    I have come to notice that if you have two artists with the same exact album name, all those files will show the album art from the first atrist that comes alpahbetically. So if I have Artist A with album name Album and Artist B which also has the album name Album, when playing a song from Artists B from Album, it will display the album art from the Artist A Album. I hope I made that clear enough. Creative has to change the way the Zen handels album art because this is just not acceptable. I worked very hard to makre sure all my songs have the right album are and the right mp3 tags and then I go and am not able to appriciate my hard work. Does this happen to anyone else?
    I cannot tell by your post. Did you embed each cover in the ID3 tag?

  • Worksetmap not showing correct links when we launch via quick link

    Hello Portal gurus,
    My Scenario:
    I'm using EP7 (SP
    Launch a quick link from a HTML to display Worksetmap iview.
    Problem:
    Displays the whole role node of links but not the relevant links.
    Displays properly when we click on the relevant DTN(detailed level navigation node(has the quicklink)) node.
    Any suggestions?
    Thanks in advance.
    Cheers,
    Surya

    Hi, the username and password on D-Link routers is case sensitive, particularly the first letter of the username.
    My Cisco Network Magic Configuration:
    Router: D-Link WBR-2310 A1 FW:1.04, connected to Comcast High Speed Internet
    Desktop, iMac: NM is on the Windows Partition, using Boot camp to access Windows, Windows 7 Pro 32-bit RTM, Broadcom Wireless N Card, McAfee Personal Firewall 2009,
    Mac Partition of the iMac is using Mac OS X 10.6.1 Snow Leopard
    Laptop: Windows XP Pro SP3, Intel PRO/Wireless 2200BG, McAfee Personal Firewall 2008
    Please note that though I am a beta tester for Network Magic, I am not a employee of Linksys/Cisco and am volunteering my time here to help other NM users.

  • Name of the Month not showing correctly in calendar

    I m facing a strange problem with the calendar, on the home screen calendar icon date & day is showing correct but when i view the full month calendar then its not showing the right month --- it is showing all the days of the March 1st to 31st correct but on the TOP in place of month it is showing February 2008 instead of March 2008. How can Feb has 31 days. I hv checked all the other settings.
    PLS HELP ME.

    Here are a couple of articles from the apple support website that might help out.
    http://docs.info.apple.com/article.html?artnum=305740
    http://docs.info.apple.com/article.html?artnum=305744

  • Date and time not showing correct whe imported to Power query

    Hi,
    I have an Excel list that I imported to another Excel file via Power query. A few of the imported columns contains date and time, for example 2013-11-09 20:19. When imported to Power query this will show as 41587.84652777778 and only dates/times with zero
    hours and minutes will show correctly. When trying to change the data type to Date/Time it returns an error for all cells containing hours and minutes.
    I use a Swedish version of Excel that uses a different time format compared to standard excel and also uses a , as a delimiter between date and time compared to the . used as delimiter in standard excel. Don't know if that can explain
    this problem?
    Brgds,
    C

    I updated Power query earlier this week, so it should be the latest version. When I created the sample file now the problem appears, so if it is a bug it has not been solved.
    You find the sample file on the link below. 4 sheets with some info on the problem, the data, the query result and one sheet with the data and query result as pictures as it shows in my version of Excel, I guess it will look somewhat different when you open
    the file due to local date/time settings.
    Appreciate feedback on what you find!
    //Caj
    https://skydrive.live.com/redir?resid=94DF9214E3A6D4!107&authkey=!AEuAXX_kPC7yKaI&ithint=file%2c.xlsx

  • I have just upgraded to Mountain Lion and my signatures for my Mail is not showing up. I have the signatures inthe preference panes and selected for the email address, but when I make a new message, the signature shows as none and doesn't give me a choice

    I have just upgraded to Mountain Lion and my signatures for my Mail are not showing up. I have the signatures inthe preference panes and selected for the email address, but when I make a new message, the signature shows as none and doesn't give me a choice. Yesterday, the signatures were stacking instead of switching to the one I wanted to choose.

    I had this and fixed it.
    I had upgraded to Mountain Lion and my signatures in Mail were fine. But then about a week later, I got a new computer and used Migration Assistant to copy my stuff to the new machine. Upon opening Mail, I had all the correct Signature information in the Preferences>Signatures window, but nothing worked.
    After lots of hunting, I found the Signature Folder. It's in:
    Yourusername>Library>Mail>V2>MailData>Signatures
    Looking at my previous setup (which works) I saw in that folder two types of files: .webarchive and .siganture
    Looking in my new machine's Signature folder, I saw only the .webarchive folders, not the .signature folders
    Since this was literally a clone of my previous setup to a new machine, here's what I did:
    1. Quit Mail
    2. In Problem machine, go to
    Yourusername>Library>Mail>V2>MailData>Signatures
    3. Move the Signatures folder someplace safe, but out of the MailData folder
    4. Get the Signatures Folder from the working install (like a backup) and copy it to the MailData folder on the problematic machine
    5. Start Mail on the problem machine
    This worked for me. I don't know why Migration Assistant didn't copy the full signature folder, but this fixed it. It worked perfectly partly because I had just backed up with Carbon Copy Cloner and the very next day set up the new machine. I don't know where Lion or earlier versions of mail stored signatures, but the absence of the .signature filetype seems to be the problem.
    Hope this helps

  • SharePont 2013 Document Library lookup Column Properties not Showing Correctly when editing in Word

    Hi
    I keep seeing this issue albeit intermittently.  I have set up a doc library for my users which has a custom content type (lookup, metadata columns, etc)  . They all appear perfectly most of the time except the lookup column. Sometimes is just
    decides to display the title field of the current library and not the lookup list title .  It is weird as it has been working perfectly for ages given the library is populated with valid documents.
    There are some fixes listed here. Has anyone got any experience of this?
    https://social.msdn.microsoft.com/Forums/azure/en-US/e0b55531-509c-4219-8113-61b3e488de69/document-library-metadata-properties-of-a-content-type-do-not-show-correctly-when-editing-in-word?forum=sharepointdevelopmentprevious
    Freelance consultant

    Hi,
    According to your post, my understanding is that the lookup  column not display well while editing in word.
    Did you customize the Document Information Panel?
    I recommend you edit your custom document information panel or create a new document information panel, then re-publish it to check whether it works.
    https://support.office.com/en-gb/article/Create-or-edit-a-custom-Document-Information-Panel-for-a-content-type-b701a9af-3ea6-4c1a-9e1c-75363bd987c9?ui=en-US&rs=en-GB&ad=GB
    Or you can also use the methods in the post you have pasted to check whether it works.
    As the limitation of the environment, we could not reproduce the issue in our environment.
    I  would suggest you open a case to Microsoft Customer Service via Phone.
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • The onhand quantity at sub inventory level it is not showing correctly

    For an item the org level quantityt is showing correctly but at sub inventory level it is not showing correctly.
    1)For an item org level the avilablty as below :
                   On Hand / Avail to Reserve / Avail to Transact are
         oRG level          7     7          7
    STAGING           7     7          7
         STORES          0     0          0     
    2) Created an Sales order with quantity 5 ,then STAGING decreased by 5 which is correct.
              the avilablty as below :
                   On Hand / Avail to Reserve / Avail to Transact are
         oRG level          7     7          7
    STAGING           2     2          2
         STORES          0     0          0     
    3) Shipping Transaction not completed,Received 4 into Stores – Staging avail increased by 6 and even STORES also increased by 4 . Here we do not understand why STAGING increased to 6.
         the avilablty as below :
                   On Hand / Avail to Reserve / Avail to Transact are
         oRG level          7     7          7
    STAGING           6     6          6
         STORES          4     4          4     
    4)Ship Transaction Completed sucessfully now the values are showing correctly.
         The avilablty as below :
                   On Hand / Avail to Reserve / Avail to Transact are
         oRG level          7     7          7
    STAGING           2     2          2
         STORES          4     4          4

    Hi Patel,
    You can create a confirmations using CO11N for sub-operations, but you can only confirm hours, not yield quantity. The yield quantity requried to be confirmed in the operation. You can partially or fully confirm sub-operations.
    Enter the order number, sub -operation number all the related data will be displayed execpt greyed quantity fields.
    Can you see the "sub-operation" entry field below "oper./activity" in CO11N ?
    Thanks & Regards,
    Ramagiri

  • Finder is not showing correct file in cover flow mode. The files shown in the top panel are one file off.

    finder is not showing correct file in cover flow mode. The files shown in the top panel are one file off.

    This problem occurs after I move a file or files to trash. If I remove one file, then the sequence is one file off, if I move two files to trash then the sequence istwo file off. For example, if I delete file 1 and highlight (click on) file 3, then the cover flow panel shows file 2, when it should show file 3.

  • Lion: Finder: Column View: Date Last Opened is not show correctly

    Hi Folks,
    I have upgrade my macs from 10.6.8 to 10.7.
    I am using the column view in the finder and I noticed that the
    Date Last Opened is not show correctly in the preview column.
    If I use the the list view and show the column Date Last Opened
    all dates are correct. Using the column view, the Date Last Opened
    allways matches the Date Last Modified.
    The attached screenshot shows an example with the same
    file at in both views mentiond above.
    I have noticed this problem with internal and external drives
    using the filesystem Mac OS Extended (Journaled).
    Is there way known to fix this behavior. In Snow Leopard it worked fine.
    Thank you for your support.

    Same here, however I found a strange work around.
    Go to your applications folder, for instance. Click the gear icon, go to Arrange By, then select Date Last Opened. It will correctly show the last opened time and arrange them accordingly. Switch back to arrange by name and the last opened date reverts back.
    It's not a bug, it's a feature!

Maybe you are looking for

  • Delivery not before date and Delivery not after date

    Hi Everyone, Can anyone help me in this issue, we need to map "delivery not before date" and "delivery not after date" from an EDI 850 into a sales order. Are there any fields to which we can map the data? if not would anyone suggest how to go about

  • Problems deploying a Web Service to Tomcat 5.5

    I am creating a J2EE 1.4 WebService using JDeveloper 10.1.3. Everything works fine while testing in the embedded OC4J server. When deploy the WAR file to Tomcat 5.5 everything goes haywire. I get the following error message: =========================

  • QuickTime Pro, DVD & Apple TV format

    With QT Pro you can export for Apple TV. I want to do this with some home videos on DVD. But I don't see a way to get the video from the DVD into QT. Am I missing something obvious here? Export seems sort of worthless if you cannot import.

  • How To Delete a Row From a TableView !!!!

    Hi, Does any know how to delete a row from a table view model. I have a TableViewModel being displayed, when the user select the particular row and click delete i want that particular row to be deleted. Any Suggestions How. Thanks, Emmanuel.

  • Value in rseg table

    While posting any transaction in JPY , the table rseg is updated for 10 times more than posted amount. In other currencies its updating correctly. What can be possible reasons?