How to put a String(date) into Date (java.util.date)??

hi there
I got a GUI here and I need to read some JMaskedTextFields from it. I put them all into Strings. Now I need to pass them to the search-function, but one of the search arguments is not string. Its Date. I tried to initialize Date with Date(String s) but he doesnt take it. Now Im asking how can I do this the easiest way?
The String has only digits and a . betwenn them, like this: 12.02.1978 and I want to pass this into the Date.
thx for helping :-)

thx
Now I got it so far, it looks like this:
String datumVon = suchen_kriterien_datVon_JMaTextFeld.getText();
String datumBis = suchen_kriterien_datBis_JMaTextFeld.getText();
SimpleDateFormat formatter = new SimpleDateFormat ("dd.MM.yyyy");
ParsePosition pos = new ParsePosition(0);
Date datVon = formatter.parse(datumVon, pos);
Date datBis = formatter.parse(datumBis, pos);
System.out.println(datVon);
System.out.println(datBis);
The Problem is that he only makes the first print when both dates are given. If I only give him the first, so he prints the first. If I give him only the scond, so he prints the second. But when I give him both, he only prints the first!!! why?

Similar Messages

  • I loaded my ipad photos from camera and all the pictures sorted by date.  Next, I did a sync with my computer and the photos were all reorganized into IMPRT folders an out of date sequence.  Any idea how to put the photos back into date files?

    I loaded my ipad photos from camera and all the pictures sorted by date.  I later sync my ipad with my computer and the photos were all reorganized into IMPRT folders an out of date sequence.  Any idea how to put the photos back into date files other than reloading all of them from camera?

    What version of iPhoto?
    Select one and rotate it. Then rotate it back. Does that make it appear? 
    A much better work flow is the keep the photos after importing.  Check the success the import, wait for at least one successful backup cycle then use you camera's format command to reformat the card
    LN

  • How to get a string "yyyyMMdd" into date like MM/dd/yyyy?.

    Hi
    How to get a string "yyyyMMdd" into date like MM/dd/yyyy?. i have used
    SimpleDateFormat.parse but it is giving long value. i want to disply the date
    like MM/dd/yyyy
    thank you

    Do you want the string rearranged or do you want to create an instance of some form of Date class?
    If you want to rearrange the string you could just do it yourself provided you know the date string is going to be of the format yyyyMMdd.
    something like this:
    String newDate = origStr.charAt(4) + origStr.charAt(5) + "/" + origStr.charAt(6) + origStr.charAt(7) + "/" ...etc.

  • How to put IPOD Shuffle I into Disk Mode ?

    How to put Ipod Shuffle I into diskmode ?

    When connected, in iTunes click on shuffle icon in Devices, then click on Settings tab. Scroll down and click the square in front of "Enable disk use", the adjust slider for amount of flash memory to reserve for data. Click Apply, and you're done!
    When you use iPod shuffle as a disk, the status light on the front of iPod shuffle blinks orange continuously, and the iPod shuffle disk icon appears on the desktop on the Mac, or as the next available drive letter in Windows Explorer on a Windows PC. Drag files to and from iPod shuffle to copy them.
    Ejecting iPod shuffle Important: If the iPod shuffle status light is blinking orange, you must eject iPod shuffle before disconnecting it from your computer. If you don’t eject iPod shuffle before disconnecting it, you could damage files on iPod shuffle.
    To eject iPod shuffle:
    Click the Eject (C ) button next to iPod shuffle in the iTunes Source list. If you’re using a Mac, you can also eject iPod shuffle by dragging the iPod shuffle icon on the desktop to the Trash.
    If you’re using a Windows PC, you can eject iPod shuffle by clicking the Safely Remove Hardware icon in the Windows system tray and selecting your iPod shuffle.

  • How to put the alv output into the spool request?

    Hi guys,
    How to put the alv output into the spool request?
    Thanks!

    Hi
    Sending an ALV List screen output to SPOOL
    Convert ALV list to PDF and send mails to respective persons
    Regards
    Pavan

  • How do I look up how to put Cafe townsend  tutorial into dreamweaver

    How do I ask how to put Cafe Townsend Tutorial into dreamweaver. I have a mac. The tutorial notes say follow this line
    (Mac OS X) Macintosh HD/Users/your_user_name/Documents/local_site. I don't understand what each section means. If someone called explain it that would be great as I ended up with an empty folder in dreamweaver with the name 'Cafe Townsend' on it. Thank you

    Right.  It's an empty local site folder until you put something into it. 
    Go to step 2.  Download and unzip the Check_Magazine.Zip files
    http://download.macromedia.com/pub/developer/check_magazine.zip
    Go to step 3. Copy the check_magazine folder into your local_sites folder (Cafe Townsend).
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.com/blogspot.com

  • Help! How to read a .txt file into a Java class and make 2D array?

    Hi guys,
    Im a newbie with arrays, just started really using them.. please bear with me if I don't seem to understand much..
    I have a .txt file that contains either a square or rectangle (random width and length).. How can I read each line into a Java class into a 2D array with rows and columns?

    Example :
    import javax.swing.*;
    import java.util.ArrayList;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.File;
    public class ReadInto2DArrayExample {
        public static void main(String[] args) {
            ArrayList array = new ArrayList();
            char [][] twoDimesionArray = null;
            try
                JFileChooser fileChooser = new JFileChooser();
                if (fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
                    File file = fileChooser.getSelectedFile();
                    BufferedReader reader = new BufferedReader(new FileReader(file));
                    String data;
                    //Read from file
                    while ((data = reader.readLine()) != null)
                        //Convert data to char array and add into array
                        array.add(data.toCharArray());
                    reader.close();
                    //Creating a 2D char array base on the array size
                    twoDimesionArray = new char [array.size()][];
                    //Convert array from ArrayList to 2D array
                    for (int i = 0; i < array.size(); i++)
                        twoDimesionArray[i] = (char [])array.get(i);
                    //Test the 2D Array
                    for (int y = 0; y < twoDimesionArray.length; y++)
                        char [] temp = twoDimesionArray[y];
                        for (int x = 0; x < temp.length; x ++ )
                            System.out.print(temp[x]);
                        System.out.println("");
            catch (Exception ex)
                ex.printStackTrace();
    }

  • How to pass a JavaScript variable into a java method

    I would like to know how to pass a JavaScript variable into a java method with in a <% %> tag inside a JSP file like so:
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <script LANGUAGE="JavaScript">
    myValue = someDynamicValue;
    <% System.out.println(myValue)%>
    </script>
    </head>
    <body>
    </body>
    </html>
    obviously "System.out.println(myValue)" will not work because myValue is seen as a java variable and not a JavaScript variable.
    I would like to know how to let the jsp file, that I wrote in the above code, see myValue as a JavaScript variable and not a java variable so that I can pass it to a java method.
    NOTE: the java method does not have to be a println() method, it can be any method of my choice.
    NOTE: someDynamicValue is a JavaScript value that can dynamically change

    I don't believe you can. JSPs are really just elaborate templates that an engine such as Tomcat parses and generates an HTML page based on. That page is then displayed to the user. By the time you want to use some function in Javascript, the JSP has already been parsed and generated.
    Basically, Javascript and JSPs can't talk to each other. One's server-side and the other is client-side.

  • How to map javax.xml.datatype.XMLGregorianCalendar to java.util.Calendar

    Hi ,
    How to map javax.xml.datatype.XMLGregorianCalendar to java.util.Calendar so that i can use pass String parameter in YYYY-MM-DD format to my Web service.
    I generated the schema classes using Jaxb 2.1.5.
    Please give suggestion
    Thanks in Advance.

    toGregorianCalendar().getTime()

  • How to put a String into a byte array

    How can i put a String into a byte array byte[]. So that i can send it to the serial port for output to an LCD display. Cheers David

    javadocs for String
    getBytes
    public byte[] getBytes()
    Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
    Returns:
    The resultant byte arraySince:
    JDK1.1

  • How to convert a String data to Double or Float???? Thank you

    I need to convert String data to Double or Float , please help me about it. Thank you very muh!
    String a=Integer.parseInt("1234"); convert to integer.

    I found it but do not know if it is ok
    float a= Float.valueof(String to
    convert).floatValue();
    may be it can be!!!
    Thank you !!!!How did parseInt lead you do valueOf?
    Look for something more consistent. A pattern.As I said earlier, it depends if he wants an object or a primitive.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to convert a STRING data to a XSTRING data?

    Hi Expert,
    In SAP, we need use a XSTING to convert a PDF document, but 3rd system send a STRING data to SAP. So I need to convert STRING to XSTRING, How to do it? Thanks in advance!
    Regards

    Hi,
    <li>Use the fm SCMS_STRING_TO_XSTRING.
      call function 'SCMS_STRING_TO_XSTRING'
        exporting
          text           = text  "type STRING
        importing
          buffer         = content. "type XSTRING
    Thanks
    Venkat.O

  • How to put a string from one Frame to another Frame?

    Dear all,
    How can I put a String from one Frame to another Frame?
    When the application started, the Frame 'WindowX' will be displayed. After you press the 'openButton', a whole new Frame (inputFrame) will be shown. In this Frame )(inputFrame) you can write a String in a TextField. After pressing the okButton, this String will be sent to the first Frame 'WindowX'.
    But does anyone know how to realize the sending part?
    I've tested this code on Win98 SE and JDK1.2.2.
    Hope someone can help me. Thanks in advance.
    import java.awt.*;
    import java.awt.event.*;
    public class WindowX extends Frame implements ActionListener, WindowListener
         private Button openButton;
         private TextField resultField;
         public static void main(String [] args)
              WindowX wx = new WindowX();
              wx.setSize(300,100);
              wx.setVisible(true);
         public WindowX()
              setLayout(new FlowLayout());
              openButton=new Button("open");
              add(openButton);
              openButton.addActionListener(this);
              resultField=new TextField(10);
              add(resultField);
              resultField.addActionListener(this);
              addWindowListener(this);     
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==openButton)
                   inputFrame ip=new inputFrame();
                   ip.setSize(200,80);
                   ip.show();
         public void place(String theString) //this doesn't work
              resultField.setText(theString);
         public void windowClosing(WindowEvent event)
              System.exit(0);
         public void windowIconi......
    class inputFrame extends Frame implements ActionListener,WindowListener
         String theString = "";
         Button okButton;
         TextField inputField;
         WindowX myWX=new WindowX();   //??
         public inputFrame()
              setLayout(new FlowLayout());
              inputField=new TextField(10);
              add(inputField);
              inputField.addActionListener(this);
              okButton=new Button("OK");
              add(okButton);
              okButton.addActionListener(this);     
              addWindowListener(this);     
         public static void main(String[] args)
              Frame f = new Frame();
              f.show();
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==okButton)
                   theString=inputField.getText();
                   myWX.place(theString);   //??
                   dispose();
        public void windowClosing(WindowEvent e) {
        dispose();
        public void windowIconi......
    }

    Thanks for your reply!
    But I got an other problem:
    I can't refer to the object (wx) made from the main Frame 'WindowX', because it's initialized in 'public static void main(String [] args)'...
    Hope you can help me again... Thanks!
    import java.awt.*;
    import java.awt.event.*;
    public class WindowX extends Frame implements ActionListener, WindowListener
         private Button openButton;
         private TextField resultField;
         public static void main(String [] args)
              WindowX wx = new WindowX();   //!!
              wx.setSize(300,100);
              wx.setVisible(true);
         public WindowX()
              setLayout(new FlowLayout());
              openButton=new Button("open");
              add(openButton);
              openButton.addActionListener(this);
              resultField=new TextField(10);
              add(resultField);
              resultField.addActionListener(this);
              addWindowListener(this);     
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==openButton)
                   inputFrame ip=new inputFrame(wx);
                   ip.setSize(200,80);
                   ip.show();
         public void place(String theString)
              resultField.setText(theString);
         public void windowClosing(WindowEvent event)
              System.exit(0);
         public void windowIconi....
    class inputFrame extends Frame implements ActionListener,WindowListener
         String theString = "";
         Button okButton;
         TextField inputField;
         WindowX parent;
         public inputFrame(WindowX parent)
              setLayout(new FlowLayout());
              this.parent=parent;
              inputField=new TextField(10);
              add(inputField);
              inputField.addActionListener(this);
              okButton=new Button("OK");
              add(okButton);
              okButton.addActionListener(this);     
              addWindowListener(this);     
         public static void main(String[] args)
              Frame f = new Frame();
              f.show();
         public void actionPerformed(ActionEvent evt)
              if (evt.getSource()==okButton)
                   theString=inputField.getText();
                   parent.place(theString);
                   dispose();
        public void windowClosing(WindowEvent e) {
        dispose();
        public void windowIconi..........
    }          

  • How to put a jsp variable into a javascript function?

    Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
    <script language="Javascript">
    function check_answer() {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer()'>");
    %>

    The following should be able to pass ans.
    <script language="Javascript">
    function check_answer(ans) {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
    %>jag

  • How to put two mono tracks into the usual stereo view in Edit view of Audition 3 ?

    Hi guys,
    Previously I have had no issues simply using Adobe Audition 3 for simple stereo recording and editing of a stereo feed taken from a mixer... well nearly no issues....  :-)
    Today, I'm having a bad day or else it's because I'm getting used to being retired.. :-)  ......
    Query :    How do I put two mono tracks into the usual stereo view in Edit view so they both display correctly there?
    Put simply I have two mono wav files. Let's call them Left_wav and Right_wav.
    I cannot seem to get them imported into a new clean Edit view (Normal stereo track layout) so that Left_wav is on the top half and Right_wav is on the bottom half.
    Whenever I try, I just get either Left_wav or Right_wav taking up the whole of the edit view. i.e. it just shows one track.
    Can anyone familiar with Audition 3 kindly help? I'd appreciate a simple step by step... I just can't see where I've been going wrong, and it's driving me bananas :-).
    Thanks

    There are various ways to do this in Audition 3. here's one.
    Open both mono files separately in Edit view. Then convert Left_wav to Stereo by going to Edit/Convert Sample Type and under Channels select Stereo with Left Mix at 100% and Right Mix at 0%. This will give you a new stereo file with Left_wav on the top channel. Next go to the Right_wav and copy to the clipboard using Edit/Copy. Return to your new stereo file and enable Edit Right channel only in Edit/Edit Channel/Edit Right Channel. Then make sure that the cursor is at start of the stereo file and Paste Right_wav into the bottom channel of the new stereo file. Finally Save As.

Maybe you are looking for