Help with the Date class

I have researched the documentation for this class, and find three constructors. One that is deprecated, one that creates a null Date object, and one that requires an explicit parameter-- a long integer which represents the amount of time in milliseconds that has passed since some day in 1970.
I have imported the java utility with this bit of code,
import java.util.*;For some reason, however, I am unable to construct a proper date object. I have passed it all different kinds of integers, but to no avail. Can anyone help me understand the documentation a little better so I can figure out what parameter it wants?

I have researched the documentation for this class, and find three constructors.I find six.
One that is deprecated,Four that are deprecated.
one that creates a null Date object,No it doesn't. Would it make sense for a constructor to create a null?
and one that requires an explicit parameter-- a long integer which represents the amount of time in milliseconds that has passed since some day in 1970.Yup, that's right.
The Date constructor that doesn't take a parameter
Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.
Not null.
Instead of java.util.Date, it is usually appropriate to use java.util.Calendar and its concrete subclass java.util.GregorianCalendar.
The static method Calendar.getInstance()
Gets a calendar using the default time zone and locale. The Calendar returned is based on the current time in the default time zone with the default locale.
See the documentation for other methods which allow you to manipulate the Date represented by the instance of Calendar.
luck, db

Similar Messages

  • Please help with the URL class

    Hello,
    I am trying to write a Java app that will take a url and download it.
    I believe you can do this with the URL class but I don't understand how to. For example, if the http url location points to a picture file, how would I code the app to retrieve this picture and save it to a specified directory?
    Also, is there a way that my java app could open another program, let's say Microsoft Internet Explorer?
    Please be as specific as possible, thanks!

    You'll see below an example to download a file
    private static String copyFile (String url, String nomFichier){
         // construction du fichier de sortie
         File outputFile = new File(repertoire + "\\fichiers\\" + nomFichier);
         // si le fichier existe d�j�, il ne sert � rien de le t�l�charger !
    if (outputFile.exists())
         return "fichiers/" + nomFichier;
              try {     
         HttpURLConnection connect = (HttpURLConnection)new URL(url).openConnection();
    boolean connected = false;
    while (!connected){
    try {
    connect.connect();
    connected = true;
         catch (java.io.IOException e1) { System.out.print("...Tentative de connection"); }     
    DataInputStream reader = new DataInputStream(
    connect.getInputStream());
         FileOutputStream out = new FileOutputStream(outputFile);
         int length = 1024;
         byte[] buf = new byte[length];
         int offset = 0;
         long offsetCourant = 0;
         int nb=0;
         while ((nb=reader.read(buf,offset,length))!= -1) {
              out.write(buf,0,nb);
         out.close();
         catch (java.net.MalformedURLException e) { System.out.println("pb d'url"); }
         catch (java.io.IOException e1) { System.out.println(e1.getMessage()); }
         return "fichiers/" + nomFichier;
    }

  • I need help with the https class please.

    Hello, i need add an authentication field in my GET request using HTTPS to authenticate users. I put the authentication field using the setRequestProperty method, but it doesn't appear when i print all properties using the getRequestProperties method. I wrote the following code:
    try{
    URL url = new URL ("https://my_url..");
    URLConnection conexion;
    conexion = url.openConnection();
    conexion.setRequestProperty("Authorization",my_urlEncoder_string);
    conexion.setRequestProperty("Host",my_loginServer);
    HttpsURLConnection httpsConexion = (HttpsURLConnection) conexion;
    httpsConexion.setRequestMethod("GET");
    System.out.println("All properties\r\n: " + httpsConexion.getRequestProperties());
    }catch ....
    when i run the program it show the following text:
    All properties: {Host=[my_loginServer]}
    Only the Host field is added to my HttpsURLConnection. The authentication field doesnt appear in standar output. How can i add to my HttpsURLConnection an Authentication field?
    thanks

    I have moved this to the main Dreamweaver forum, as the other forum is intended to deal with the Getting Started video tutorial.
    The best way to get help with layout problems is to upload the files to a website and post the URL in the forum. Someone can then look at the code, and identify the problem. Judging from your description, it sounds as though the Document window is narrow, which would result in the final menu tab dropping down to the next row. Try turning on Live view or previewing the page in a browser. Design view gives only an approximate idea of the final layout. Live view renders the page as it should look in a browser.

  • NEed help with the data plan

    Okay thank you for your time. I am planning on buying an iphone but I want to know that if it is necessary to but the data plan?? I really don't need it to search the web. But is it really necessary? one more thing also do you have to really have to sign up to itunes store???
    can you please really get back to me as soon as possible thanks alot thank you or email me at [email protected]

    It's also a very bad idea posting your e-mail address in public Discussions.

  • Help with the date field!!! in opportunity

    hello friends!!!!
    I have a requirement that in opportunity tab milestone we have created date profile with 4 different date types and position them to milestone tab in opportunity header data.
    Now the issue is out these 4, 2 of them we wish to have as mandatory fields
    date type                     desciption
    ZNOH_CONTSIG          Date of signature
    ZNOH_COSTART         Contract Start Date
    Can you please help how is that possible..
    what procedure will it be behind this !!

    Hello Manuel Rodriguez 
    I have awarded you 6 points for your helpful answer as it didn´t solve my question posted here but a related issue was solved.
    I tried to use the incompletness procedure and also the badi but in both the ways you can check for a field but in my case in opportunity tab milestone
    it looks like an ALV with CRM concept it has date profiles behind that using date management in SPRO. Please have a look if possible.
    Any help would be gr8 and any ideas from people which can give me any infos about it will be great!!!!!!!!!!!
    Many thanks in Advance.
    Pankaj

  • Hi, I need help with the dates of plugins added to my browser

    Hi I need to know what date a plugin was installed on my browser.
    openh264 / video codec provided by cisco systems.
    If you can't help, please point me in the direction of someone who can?
    Any help greatly appreciated.

    The new "OpenH264 Video Codec provided by Cisco Systems, Inc." plugin that now shows up in the Firefox Add-ons Manager Plugins list was added in Firefox 33.0. It's installed in a subfolder of your [[Profiles|Firefox profile folder]], which you can confirm by typing '''about:plugins''' in the Firefox address bar to bring up a list of installed plugins (details [http://kb.mozillazine.org/Issues_related_to_plugins#Identifying_installed_plugins here]) and checking its "Path" entry .
    The first link in the [https://www.mozilla.org/en-US/firefox/33.0/releasenotes/ Firefox 33.0 release notes] under What’s New, has this:
    '''New''' | [http://andreasgal.com/2014/10/14/openh264-now-in-firefox/ OpenH264 support] * (sandboxed)
    [*] Quoted from the linked page, http://andreasgal.com/2014/10/14/openh264-now-in-firefox/
    (which also includes a [https://andreasgal.files.wordpress.com/2014/10/openh264.jpg screenshot] of the Add-ons Manager entry):
    <blockquote>Today in collaboration with Cisco we are shipping support for H.264 in our WebRTC implementation. </blockquote>
    <blockquote>Cisco has agreed to distribute OpenH264, a free H.264 codec plugin that Firefox downloads directly from Cisco.</blockquote>
    <blockquote> Note: Firefox currently uses OpenH264 only for WebRTC and not for the <nowiki><video></nowiki> tag, because OpenH264 does not yet support the high profile format frequently used for streaming video. We will reconsider this once support has been added. </blockquote>
    See also:
    *https://wiki.mozilla.org/Media/WebRTC
    *https://wiki.mozilla.org/GeckoMediaPlugins

  • I need help with the dates on a macbook

    HI i've recently bought a macbook a1260, the chap has sold it too me for £330 on the basis that he bought it brand new back in 2011 making it just 4 years old, my problem is all im getting is that it's the '08 model, which makes me think that it is without doubt that the macbook could of been bought brand new in 2011, or would apple still sell there 3 year old models brand new. Any help on this subject would be highly appreciated because i'm worried that i've been ripped off for the price. Thank you

    COULD NOT OF BEEN BOUGHT BRANDNEW IN 2011** apologies

  • Why is it ok for a verizon wireless service representative to lie to a customer? I went over my monthly data and i called to ask for some help with the overage because i was barely over. They told me they would take care of it and sold me on a shared data

    why is it ok for a verizon wireless service representative to lie to a customer? I went over my monthly data and i called to ask for some help with the overage because i was barely over. They told me they would take care of it and sold me on a shared data plan that would result in 2gb less data but told me i would save 20$ a month. I agreed and recieved my next statement and to my suprise my bill actually went up 15$ a month and i talked to several people and they all told me there is nothing that can be done to get back on the plan i was on and they can not even give me a discount to get me back to what i was paying. They can only offer me a convenience credit. I will be cancelling service.

    ajwest101,
    We do not want to see you go. I truly apologize for any misinformation regarding your plan. Let's investigate into this a little further. What plan were you on? What plan were you switched to? If you look at the detailed billing online of your previous bill do you see any additional charges other then the plan?
    LindseyT_VZW
    Follow us on Twitter @VZWSupport

  • HOWTO: Use the Spring data access methods together with the WebRowSet class

    With the WebRowSet class I can easily iterate over a ResultSet and produce some XML using the code below.
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection connection
    = DriverManager.getConnection("");
    Statement statement = connection.createStatement();
    ResultSet resultSet = statement.executeQuery("SELECT SYSDATE FROM DUAL");
    WebRowSet webRowSet = new WebRowSetImpl();
    webRowSet.populate(resultSet);
    statement.close();
    connection.close();
    webRowSet.writeXml(new FileOutputStream("C:\\SYSDATE.xml"));
    So, how would I use the simplified Spring methods to do the same thing? The WebRowSet.populate method only supports a ResultSet object. The Spring framework only returns an SqlRowSet object that is not easily cast to the ResultSet, etc.
    Thanks for your help.
    Edited by: mrmeth0d on Jan 3, 2008 2:02 PM

    So, how would I use the simplified Spring methods to do the same thing? The WebRowSet.populate method only supports a ResultSet object. The Spring framework only returns an SqlRowSet object that is not easily cast to the ResultSet, etc.
    Cast Spring's SqlRowSet to ResultSet? Impossible. It's an interface that does not extend java.sql.ResultSet.
    javax.sql.WebRowSet is an interface that extends java.sql.ResultSet.
    Spring does have a concrete class ResultSetWrappingSqlRowSet whose constructor can take a java.sql.ResultSet.
    So I think your solution is to instantiate a new ResultSetWrappingSqlRowSet, passing it your javax.sql.rowset.WebRowSet, and return that wherever Spring wants to return a SqlRowSet.
    %

  • How to update a table (CUSTOMER) on a Report Server with the data from the same table (CUSTOMER) from another server Transaction server?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) From another server ex: Transaction server?
    Set up steps so inset, update or delete operation takes place across the servers.
    It would be great if someone please enlighten me in details about this process in MS SQL Server 2008 R2.
    Also please describe would it be different for SQL Server 2012?
    If so, then what are the steps?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) from another server ex: Transaction server?
    Set up steps so that inset, update or delete operation gets done correctly across servers.
    I was not sure about the answer, it would be great if someone please put some light on this and explain in details about this process in MS SQL Server 2008 R2.
    Also it would be very helpful if you please describe would it be different for SQL Server 2012? If so, then what are the steps?

  • How to make the active save-to-file with the data from GPIB ?

    Hello,,everybody !!
    I want to make the active save-to-file with the data from GPIB since starting the measurement. To save-to-file at the end of measurment is somehow risky for losing the data because my measurment have to take for long time (eg. 24-48 hours).
    Thank you in advance for anybody's help !!

    Thanks Dennis,
    I have already append, I got it but still have one small problem that between each line it has the blank line. Example as below ,
    16:40:33 54.24
    16:40:34 54.23
    16:40:35 54.24
    I want to get rid of the blank line in between.. Do you have the idea about it ?

  • I need help proving the date tag on a photo stored in my iPhoto is from the date it was sent to my iphone/date it was imported into iphoto - and that it is NOT the date the photo was actually taken.  Please help!

    I need help proving the date tag on a photo stored in my iPhoto is from the date it was sent to my iphone/date it was imported into iphoto - and that it is NOT the date the photo was actually taken.   I recieved a photo via text on my iphone and then I synced my iphone to my macbook and now it is in iphoto.  I already know that the date on the photo per the tag that shows up on it in iphoto is NOT the date the photo was actually taken.  I need article or literature or something confirming the tag is from when it was sent to the iphone and/or when it was imported.  I greatly appreciate some assistance!

    All I am trying to do is find something on a forum board or article etc stating that the the date showing in iphoto could be the date it was imported or synced or sent to me and not the actual date taken.
    The date on the photo could be anything because you can edit the date with iPhoto or any of 100 apps, free and paid for. So, the date on the photo will prove nothing, I'm afraid.
    Regards
    TD

  • Problem with the date conversion

    Hi Friends,
    i am facing the problem with the date conversion,  Actuall my requirement is to pass the date to the screen based on the user setting roles(SU01).
    I have fetched the user setting date format by using the funciton module SUSR_GET_USER_DEFAULTS, The function module picks the exact user date setting (Like as MM/DD/YYYY, MM.DD.YYYY, DD.MM.YY).
    After that i have implemented the FORMAT_DATE_4_OUTPUT funciton module for converting of the user role setting date format into system  date format.
    for the english language case the funciton module FORMAT_DATE_4_OUTPUT works fine but the funciton module not supported for other languages
    Can you please provide the Function Moudle for user setting date conversion.
    The funciton module is most important for us,
    Thanks
    Charan
    Moderator message: date conversion questions = FAQ, please search before posting.
    Edited by: Thomas Zloch on Dec 21, 2010 2:19 PM

    Hope this logic helps you.
    DATA LF_DATE    TYPE DATS VALUE '21122010'. " 21-dec-2010
    DATA LF_DATE_BI(10).
    WRITE LF_DATE TO LF_DATE_BI.  "Now LF_DATE_BI contains the date in user format
    "Now populate the value LF_DATE_BI to the screen field

  • Help with the a query -

    I have the table test1 with a date field stored as character 7 field.
    (which is for CYYMMDD)
    C - century indicator
    and there are 3 rows in that table for testing purposes.
    One of them has a value 9999999 which is a incorrect value for a given date.
    I want to get all the rows with the value grater than 20020101 from that table.
    Noted below are my table, values and query I used.
    Can anyone help me with this?
    create table test1(cr_date char(7);
    SQL> desc test1
    Name Null? Type
    CR_DATE CHAR(7)
    SQL> select * from test1;
    CR_DATE
    9999999
    2021009
    1980101
    3 rows selected.
    select
    to_number(to_char(to_date((substr(cr_date,2,7)),'RRMMDD'),'RRRRMMDD'))
    from test1 where cr_date<>'9999999' and
    to_number(to_char(to_date((substr(cr_date,2,7)),'RRMMDD'),'RRRRMMDD'))>20020101
    I get this error:
    ERROR at line 2:
    ORA-01843: not a valid month

    But I don't have the control over this table because this is maintained by a real old
    system in the MainframeI didn't say (or at least didn't mean to say) it was your fault. My point was that you need to have error handling in place for non-date values.
    Note that Otto's solution will fail if any of the values in cr_date are non-numeric. Given that you have no control over what that column contains and that it is a string column you probably ought to handle that situation, unless you know for certain sure that everything in it will always be a number.
    If you want to do so the easiest way would be to write a user defined function that applies a TO_DATE to the input argument and handles invalid dates by returning null or whatever takes your fancy. Other solutions may be more appropriate, depending on what you want to do with the data.
    Cheers, APC

  • Need some help with the Select query.

    Need some help with the Select query.
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    select single vkorg abgru from ZADS into it_rej.
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
            VKORG TYPE VBAK-VKORG,
            ABGRU TYPE VBAP-ABGRU,
           END OF IT_REJ.
    This is causing performance issue. They are asking me to include the where condition for this select query.
    What should be my select query here?
    Please suggest....
    Any suggestion will be apprecaiated!
    Regards,
    Developer

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

Maybe you are looking for

  • Keynote and Gotomeeting issue

    When I do a live online gotomeeting and use Keynote as my presentation app, the other parties just see a blank screen. Other presentation apps (PPT, OpenOffice) work fine. Any ideas? Thanks.

  • SLD Data Supplier User is locked at regular intervals

    Dear Sirs, I have a Webdynpro application using two JCO connections to the backend to fetch data. One day it just stopped working. After some searching I found out that my SLD Data Supplier user was locked in the UME, due to too many failed logins. 

  • CS4 on Mavericks?

    i own CS4, which worked fine on my previous macbook pro. i have now updated to the latest macbook pro, running mavericks, and when i try to open photoshop i get "Error: 150:30" what can i do to activate my apps? adobe has been NO HELP at all!

  • Error downloading trial

    I cannot download the trial version of Dreamweaver or Photoshop. I've tried different browsers (IE and Chrome) and operating systems (Windows 7 and 8) to no avail. Please advise.

  • Where is the Backup directory in WinXP?

    I would like to be sure I am backing up the back up. Also, is it possible to specify a different directory than a default one? I'd like all data of this type to go to an external drive. Cheers and thanks, Arthur