Coverting Date.toString() back to a new Date object

http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#toString()
After reading this, I am able to see the output format:
dow mon dd hh:mm:ss zzz yyyy
However, my questions is, what if you want to convert this String back into a new Date object later? After reviewing SimpleDateFormatter and other related classes, I find nowhere there is a linked parsing that allows this to be easily coverted back into a new Date object at runtime.
Am I wrong?
Thanks.

Yup, the problem is that I do not have a reference to
the original string. Is there a simple direct way to
do this?Wait, I misread this. The original string?
If you have a Date and get a String out of it, and you later want the original Date, then it's generally better to restructure your app to preserve the original Date. If for some reason that isn't an option (although often things are options when you don't think they are), then you can use SimpleDateFormat to produce a new Date object who value matches the date that the String represents.

Similar Messages

  • Retain data in String Display untill new data is delivered in RS-232

    I am using Labview 8.6 on Windows XP OS and acquiring signal from RS-232 through COM1 port to which I have connected non NI instrument. My instrument sends data for flash of second and it displayed into String Indicator for flash of second. How to hold this data untill I get new data from instrument. I have tried to select "re-initialise to default value" and "make current value default" but none of them getting selected. I want data to be retained untill new data comes. I have enclosed VI as well as Picture file. Pl advice. 
    Attachments:
    HPLC Flow Meter 3.vi ‏32 KB
    HPLC FLow 3.JPG ‏123 KB

    -Looks you are sending or running the while loop every 5ms, are you sure you want this fast? This is the reason the data comes in flash(i think 5ms)
    -I use shift register to store something from previous iterations generally.
    -You need to keep case structure to check when new data comes and when it does, replace the value in that string.
    -else pass previous value to string.
    Thanks
    uday,
    Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
    Certified LabVIEW Associate Developer (CLAD) Using LV13

  • ERR:10003 Unexpected data store file exists for new data store

    Our TimesTen application crashes and then it can not connect TimesTen datastore, and then we use ttIsql and get error "10003 Unexpected data store file exists for new data store".So we must rebuild the DataStore.
    I guess the application damages the datastore because we use "direct-linked" mode. Is it true?
    Should I use "Client-Server" mode if our data is very important?
    thx!

    Your question raises several important discussion points:
    It is possible (though very unlikely in practice) for a C or C++ program operating in direct mode to damage the contents of the datastore e.g. by writing through an invalid memory pointer. In the 11+ years that TimesTen has existed as a commercial product we have so far never seen any support case where this was diagnosed as the cause of a problem. However, it is definitely a theoretical possibility and rigorous program testing and use of tools such as Purify is strongly recommended when developing in C or C++ in direct mode. Java programs running in direct mode are completely 'safe' unless they invoke non-Java code via JNI when a similar risk is present.
    The reality is that most customers who use TimesTen in very high performance mission critical applications use mainly direct mode...
    Note also that an application crashing should not cause any damage or corruption to a datastore, even if it is using direct mode, as Times%Ten contains explicit mechanisms to guard against this.
    Your specific problem (error 10003) is nothing to do with the datastore being damaged. This error reflects a discrepancy between the instance main daemon's metedata about all the datastores that it is managing and the reality. This error occurs when the main daemon does not know about a datastore and yet when it comes to connect to (and hence create) the datastore it finds that checkpoint or log files already exist. The main daemon's metadata is managed solely by the main daemon and is completely separate from the datastore and datastore files (the default location is <tt_instance_install_directory>/info, though you can change this at install time). The ususal cause of this is that someone has been manually manipulating files within that directory (which of course you should never do) and has removed or renamed the .DBI file corresponding to the datastore.
    This error should never arise under normal circumstances and certainly not just because some application has crashed.
    Rather than simply switching to the (much slower) client/server mode I think we should try and understand why this error is occurring. Could you please post the following:
    1. Output of ttVersion command
    and then we can take it from there.
    Thanks, Chris

  • Converting Date.toString() back to a Date object for compare

    I know this is beating a dead horse to death but I have wasted a whole day trying to get this to work. Here is the problem.
    I need to convert a Date().toString (format returned: Dec 19, 2006 3:39:58 PM EST) back to a Date object. What I am doing is writting this string a text file and then revisiting it to compare later to a current Date object to find the difference in the two stamps in milliseconds.
    J2SE 1.4.2 being used
    Date date = new Date();
    String newDateStr = log[1].trim(); // entry from log file
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date logDate = dateFormat.parse(newDateStr);
    // get difference between the two
    long timeSpan = date.getTime() - logDate.getTime();
    if(timeSpan > 60000){
        // TO DO
    }So should I look at a different approach at either:
    A) Storing the date/time stamp in the text file
    B) The conversion back to Date object is wrong
    Really appreciate any insight on this.
    Thanks
    JLW
    Message was edited by:
    jlwestsr

    Then my friend you are in the same status as Tim.:o)
    I don't know as much as him and I don't care to write
    an elaborate reply most of the time. :D
    Merry ChristmasSame to you.I don't pretend to know that much, but When I see something I do know, I tend to give examples.
    Most probably that is because at the present time I am in a situation where most of my time is spent waiting for a call from the customer, and the app I am supporting works so well that those calls are few and far between. Lucky for me, they pay me for sitting around and answering questions on a forum.
    At least it is a java forum, where I can justly claim that I am improving my knowledge of java.
    ~Tim

  • I have a new mac book, I have loaded all my old data on it via time machine. I want to now erase all that data so it is back to a new data free computer. it has yosemite, how do I remove all the data???

    I want to erase all the data I loaded onto my new macbook pro yosemite. I want to have it cleaned of all the data photos etc I have loaded so it is like a new computer again. I already have all this data on a hard drive so I don't need to back the data up.???

    Install or Reinstall OS X from Scratch
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Erase the hard drive:
      1. Select Disk Utility from the main menu and click on the Continue button.
      2. After DU loads select your startup volume (usually Macintosh HD) from the
          left side list. Click on the Erase tab in the DU main window.
      3. Set the format type to Mac OS Extended (Journaled.) Optionally, click on
          the Security button and set the Zero Data option to one-pass. Click on
          the Erase button and wait until the process has completed.
      4. Quit DU and return to the main menu.
    Reinstall OS X: Select Reinstall OS X and click on the Install button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
               because it is three times faster than wireless.

  • LabVIEW created .DAT file with saving only new data on existing files

    I can successfully create and save a .DAT file using LabView and Diadem.   The save command I am using (in Labview) only overwrites existing files, I would like it to save only the new data from the last save.  Overall I would like to save the data every 1hr and since my test will last for many hours, the further along in the test the longer it would take to save the full file.  I know Diadem has the capability to save in such a manner, so I have thought about after I write to Diadem have a small Diadem application save periodically, but I haven't found a way to save the .DAT file, with out any signals coming into the save function.  I have attached the example .DAT file creater and saver I am using to figure it out.  thanks for your help!

    Howdy New Guy -
    I am not sure if you are looking to append to a file, or if you would
    like to overwrite a file.  In either case, you can take a look at
    the "Append To File.vi" example for DIAdem. 
    Either way, you may be experiencing problems because you are only using
    the "DIAdem Simple File Write.vi" (found on the DIAdem >> DAT
    Files palette).  Instead, you can use the "DIAdem File Write.vi"
    (located on teh DIAdem >> DAT Files >> DAT Files Advanced
    palette).  This VI can be set to overwrite or append to file.
    I hope this helps in your development!
    Andrew W. || Applications Engineer

  • Query for Old Data that does not match New Data within a given time period

    Hello all,
    One of the reports I need to create is for all associates who went from one department to another within a given time period. The way I ran this report in Reportsmith (pulling from our old system) was to compare the dept field from the beginning date to the dept field at the end date and it would give me those associate's that had moved. I had to do it this way b/c dept changes can happen using several different types of actions (supv change, promotion, etc.), none of them exclusive to just dept changes. We are now using Oracle HRMS and I need to create this same report with this system using SQL.
    Does anyone know how to compare data between two different dates and pull the ones that don't match? Your help will be GREATLY appreciated!
    Warm Regards,
    Yasmin E. Alberto
    HRIS Analyst
    [email protected]

    Hi, Yasmin,
    In the sample data you posted, nobody changed departments between May 1 and May 11. In fact, there were no assignments of any kind between January 16 and May 17, so I wouldn't expect any output for that period.
    A person (or rather, a duck) did change deptartments on May 20, so if you change the upper limit of the date range to
    AND    ASG_LAST_UPDATE_DATE < TO_DATE ('05/21/09', 'MM/DD/RR')you should see her.
    You've probably noticed that this site likes to compress white-space.
    To post formatted text (such as table results or indented code) type these 6 characters:
    (small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • "Save As" is saving the date years back.. not current date..??

    I just upgraded to Elements 10 and I've found this problem...
    When I create a scrapbook page and and go to save it as "Save As" for both my PSD & JPG files, it is saving the file date that my background layer was added to my Elements Organizer, no the actual date that I created the page.
    Example:  I created a page last night, I named "JFK.jpg".  When I got to Explorer to upload to Shutterfly and look for the file with details, it shows: JFK.jpg  1709kb    JPEG Fomat    03/28/2008 7:24AM
    I always sort by date to find my most recent pages and this is driving me crazy!!  Please help!  Any Suggestions???

    Two possibilities.
    First create a formula that will give you the date as a text cell.
    If you dates are in the B column then you could add
    =TEXT(B1;"YYYY-MM-DD")
    in the C column. This will then export correctly for you.
    This way means moving columns around of course.
    Second - the format of the data is controlled by your global language settings.
    Tools > Options > Language Settings > Language
    Use the Local Settings drop down to select a local that gives your the format you need. It is a thought any way.

  • 1003 error:unexpected data store file exists for new data store

    dear chris
    when we use timesten, what happened cause the error 1003, I don't know what cause it happen. it works well before. but it happened today twice.
    anyone know the reason ?? Any help is appreciated!
    Thanks

    The TimesTen daemon maintains a 'catalog' containing information about datastores that it is managing. From the daemon's perspective, a datastroe is uniquely identified by the pathname for the checkpoint files (the value of the DataStore attribute in a DSN definition). The daemon knows nothing about DSNs or ODBC.INI files...
    A datastore is physically created, and hence registered with the instance daemon, the first time something connects to it specifying the ODBC/connection attribute AutoCreate=1 (which is the default value). From that point, the datastore has a physical existence (checkpoint and log files exist on disk), is known to the daemon and hence will appear in the output of the ttStatus command.
    If at the time you connect to a datastore with AutoCreate=1 and the daemon has no record of the datastore it will try and create it. If it finds that the checkpoint files already exist in the specified location on disk then this is 'unexpected' (since the datastore should not exist yet) and error 1003 results.
    Seems like you have somehow got some checkpoint files existing that the daemon does not know about. You have made some kind of mistake somewhere I guess; maybe you copied files around inadvertently?
    Chris

  • Jsf not rendering the new data

    On the page a.jsp, when i select the year and company name, it displays the reqd company info. when i click edit, it goes to b.jsp and displays those information. after i edit, i click save. data is updated in the database and it goes back to a.jsp and displays the new data. now in a.jsp, when i select the year and company name, it shows the prior data and not the new data. even if logout of the appl and login again, this does not show the new data. only when i restart the appln server, i am able to see the modified data
    Can someone please help me on this. thanks.

    Crossposted:
    [http://forums.sun.com/thread.jspa?threadID=5447882&messageID=11036013#11036013|http://forums.sun.com/thread.jspa?threadID=5447882&messageID=11036013#11036013]
    If you don't get an answer, do you really think it is going to help to simply post the exact same question again?
    Why don't you do yourself a favor and try to reason about the problem yourself. You can be 100% assured this is your own fault that this is happening, somewhere in your code is a mistake. So where could it be? What could you have done to make the page display the old data in stead of the new data?
    Perhaps you will also want to invest some time into learning how to use a debugger, those things were invented to be able to work out these kind of "mysteries".

  • Best Approach to Compare Current Data to New Data in a Record.

    Which is the best approach in comparing current data to new data for every single record before making updates?
    What I have is a table with 5,000 records that need to be updated every week with data from a data feed, but I dont want to update every single record week after week. I want to update only records with different data.
    I can think of these options:
    1) two cursors (one for current data and one for new)
    2) one cursor for new data and one varray for current data
    3) one cursor for new data and a select into for current data.
    Thanks for your help.

    I don't recommend it over merge, but in theory you could use a checksum (OWA_OPT_LOCK.checksum()) on the rows and if they differ then copy the new row into the destination table. Or you might be able to use rowscn to see if things have changed.
    Like I said, I don't know that I 'd take either approach over merge, but they are options.
    Gaff
    Edited by: Gaff on Feb 11, 2009 3:25 PM
    Actually, rowscn between 2 tables may not be an option. I know you can turn a rowscn into a time value so if that rowscn is derived from anything but the column values for the row that would foil that approach.

  • Can't we add new dates automatically via MDIS- unmapped values- ADD

    Hi,
    I have a qualified table with non qualifier as Date(TYPE: Literal Date).
    and Qualifiers as Valid from and valid to.
    We have 4 dates currently in Date field.
    Our incoming file will have New dates init, So want these new dates to be added automaticaly via Import map.
    I have set the Date field property as MDIS unmapped fields as - ADD.
    But it is not adding new dates.
    When i have Date field with Type TEXT and not 'Literal Date'  then the new dates from Incoming file are added automatically.
    Is this Normal that MDIS unmapped value - ADD will not add date Type fields???
    Please Help
    KR
    John

    Hi,
    the incoming date format is MM/DD/YYYY.
    In configutration parameters it is mentioned as MM/DD/YYYY format.
    If the incoming file has Existing dates in MDM then it updates Fine.
    But if the Incoming file has a new date then it failes with value exception..
    'error message : Type mismatch. Invalid field values.<LF/></Trace>
    cant understand this behaviuor of Literal date Field...
    Can anyone please help...
    KR
    John

  • Fetch New Data Issue

    Hi,
    I have 3 exchange accounts configured in my iPhone4 (iOS 4.2.1): 2 GMail accounts and 1 company account.
    My goal would be to check every 15min the GMail accounts, and only manually the company account.
    My configuration as follows:
    Fetch New Data > Push > Off
    Fetch New Data > Fetch > Every 15min
    Fetch New Data > Advanced > GMail accounts > Select Schedule > Fetch
    Fetch New Data > Advanced > Company account > Select Schedule > Manual
    I rebooted iPhone many times, but every time the app checks for GMail accounts (mail app is NOT already running), it checks for Company account too (even if fetch is set to Manual for this account), and it shows me mail counter on app icon (before to open the app).
    Shouldn't "Fetch New Data > Advanced" override "Fetch New Data > Fetch"?
    Please tell me if I'm going wrong or if there's a solution for this issue.
    Thanks a lot!

    After some tests, the problem seems to occur only if there are some non-read messages in the company account, when mail app check for other accounts.
    Any suggestions?
    Thanks

  • Difference between using new Date() and new Date(System.currentTimeMillis()

    Hi All,
    I have seen many open source api's where they are updating dates with the following code
    new Date(System.currentTimeMillis())
    when i print the new Date() it prints the same
    what is the difference between using new Date() and new Date(System.currentTimeMillis()) ??
    Thanks,
    J.Kathir

    when i print the new Date() it prints the same
    It does because of backward compatability. This constructor exists in version 1.3.1 but not in newer versions.Really ? Please point me to where you read that.
    API doc 1.5 : new Date() (still there, not even deprecated)
    A quick look at the code for this constructor:    /**
         * Allocates a <code>Date</code> object and initializes it so that
         * it represents the time at which it was allocated, measured to the
         * nearest millisecond.
         * @see     java.lang.System#currentTimeMillis()
        public Date() {
            this(System.currentTimeMillis());
        }

  • I bought new i phone 5 3 days back, after that asked for new update which is 6.1.4, after updating my iphone i am not able to use cellular data services. I called up data provider, they says its the problem with new software update. There is no option add

    I bought new i phone 5 3 days back, after that asked for new update which is 6.1.4, after updating my iphone i am not able to use cellular data services. I called up data provider, they says its the problem with new software update. There is no option add APN. Now when i switch to safari its showing you are not subscribed for cellular data. But I am able to use data on other phone.
    Will you please help me in this regard?
    Another issue, since i bought my new iphone there is dust inside back main camera.
    Your advises are highly appreciated.

    Hey Shaiju isac,
    I'd take a look at the following article, it'll guide you though steps to you troubleshoot cellular data issues on your iPhone:
    iPhone: Troubleshooting a cellular data connection
    http://support.apple.com/kb/ts3780
    Cheers,
    David

Maybe you are looking for