What class / API should i used ?

Hi, all
what api should i used when i want to know present time (hour-minute-second) or date... i've used :
GregorianCalendar kal = new GregorianCalendar();
int year=kal.YEAR;
instead i got year is 1 ??? (for present year !!) ...
it does the same as hour and minute... i dont have the exact time like the time in my win task bar.. plzzz help me...

This should help:
*  Calendar Demo (by Sun, with modifications)
import java.util.*;
public class CalendarDemo {
    public static void main(String[] args) {
// get the supported ids for GMT-08:00 (Pacific Standard Time)
        String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
        // if no ids were returned, something is wrong. get out.
        if (ids.length == 0) {
            System.exit(0);
// create a Pacific Standard Time time zone
        SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
// set up rules for daylight savings time
        pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
        pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
// create a GregorianCalendar with the Pacific Daylight time zone
// and the current date and time
        Calendar calendar = new GregorianCalendar(pdt);
        Date trialTime = new Date();
        calendar.setTime(trialTime);
// Change month numbering to 1-12
        int monthNumber = calendar.get(Calendar.MONTH)+1;
// begin output
        System.out.println("Current Time");
// print out a bunch of interesting things
        System.out.println("ERA: " + calendar.get(Calendar.ERA));
        System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
        System.out.println("MONTH: " + monthNumber);
        System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
        System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
        System.out.println("DATE: " + calendar.get(Calendar.DATE));
        System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
        System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
        System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
        System.out.println("DAY_OF_WEEK_IN_MONTH: " +
            calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
        System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
        System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
        System.out.println("HOUR_OF_DAY: " + calendar.get(Calendar.HOUR_OF_DAY));
        System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
        System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
        System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
        System.out.println("ZONE_OFFSET: " +
            (calendar.get(Calendar.ZONE_OFFSET) / (60 * 60 * 1000)));
        System.out.println("DST_OFFSET: " +
            (calendar.get(Calendar.DST_OFFSET) / (60 * 60 * 1000)));
        System.out.println("Current Time, with hour reset to 3");
        calendar.clear(Calendar.HOUR_OF_DAY);
        // so doesn't override
        calendar.set(Calendar.HOUR, 3);
        System.out.println("ERA: " + calendar.get(Calendar.ERA));
        System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
        System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
        System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
        System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
        System.out.println("DATE: " + calendar.get(Calendar.DATE));
        System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
        System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
        System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
        System.out.println("DAY_OF_WEEK_IN_MONTH: " +
            calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
        System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
        System.out.println("HOUR: " + calendar.get(Calendar.HOUR));
        System.out.println("HOUR_OF_DAY: " + calendar.get(Calendar.HOUR_OF_DAY));
        System.out.println("MINUTE: " + calendar.get(Calendar.MINUTE));
        System.out.println("SECOND: " + calendar.get(Calendar.SECOND));
        System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
        System.out.println("ZONE_OFFSET: " +
            (calendar.get(Calendar.ZONE_OFFSET) / (60 * 60 * 1000)));
        // in hours
        System.out.println("DST_OFFSET: " +
            (calendar.get(Calendar.DST_OFFSET) / (60 * 60 * 1000)));
        // in hours
}

Similar Messages

  • I would like to move 2 users to creative cloud, but maintain all the other users (myself included) on CS5. Can I still get the reduced monthly rate? What serial number should I use?

    I would like to move 2 users to creative cloud, but maintain all the other users (myself included) on CS5. Can I still get the reduced monthly rate? What serial number should I use?

    Hi Thomasjewell,
    Yes you can avail the discounted prices even you are upgrading the product just for two users. You can use the serial number for your Creative Suite 5 product.
    You can follow the link: https://creative.adobe.com/plans in order to purchase Creative Cloud for Teams product.
    Let me know if it works or not.
    Thanks,
    Ratandeep Arora

  • I'm showing a video on a wall that's 3646 x 768 px. What project dimensions should I use to best fit the space?

    I'm showing a video on a wall that's 3646 x 768 px. What project dimensions should I use to best fit the space?

    Try this : http://library.creativecow.net/payton_t/FCPX_Custom-Resolution-Timelines/1
    Switchie2

  • HT201376 How do I go about unlocking a recovery HD? Also I need to know what disk image should I use when trying to restore a failed(erased) disk in DU?

    Also I need to know what disk image should I use when trying to restore a failed(erased) disk in DU?

    You need to plug it into your computer running iTunes and restore it. Have you tried that? If so, what happened?

  • I want to create fillable PDF that can be used by many people running on both MAC and PC.  What Adobe product should I use?

    want to create fillable PDF that can be used by many people running on both MAC and PC.  What Adobe product should I use?

    Hans-Gunter
    Thanks so much.  I downloaded Acrobat XI.  It's been "extracting" for the past 30 minutes (even with a fast wi-fi).  Hope this is not a problem.
    Anne

  • What pdf tag should I use for footnotes?

    I get involved in generating fully accessible tagged pdf's for asisstive technologies and the like. I have a doc in InDesign which uses footnotes. When I tag the document, should I map the footnotes (paragraph) style to a particular predefined pdf tag (http://www.alistapart.com/d/pdf_accessibility/PDFtags.html) and if so which one? P, STORY, NOTE....? I'm not sure and can't find any reference out there to help me.

    offtheroad wrote:
    What instrument area should I use for pulling in iTunes files to edit together, Voice, guitar, ...
    drop the files into a blank area of the timeline and GB will create a track for the files. if you want to do it manually, create a New Basic Track

  • HT201788 What speed disks should i use in an Apple Superdrive

    What speed disks should i use in an Apple Superdrive?
    Thanks

    It matters little. The slower the burn speed, i.e. 2x or 4x, the better the burn.
    What is important is the brand of media: most of here recommend Verbatim, Maxell and Taiyo Yuden.

  • EWS Managed API Should I use GUID or DefaultExtendedPropertySet.PublicStrings while constructing DefaultExtendedPropertySet

    I am developing C# .NET Framework 4.5 Windows Form application using EWS Managed API 1.2 with Exchange Server 2007 which performs some sort of syncing of mails.
    Now that I am dealing with Extended Properties, I want to be clear some things:
    Q1. What is the purpose of DefaultExtendedPropertySet class?
    MSDN says "Defines
    the default sets of extended properties."
    Is it just to group the extended properties?
    If yes, why is the grouping there at first place?
    Do we have any Ews API method which can fetch values of all extended properties belonging to the same group on an item?
    Q2. I am unable to decide whether should I use custom GUID or DefaultExtendedPropertySet.PublicStrings while
    constructing ExtendedPropertyDefinition:
    ExtendedPropertyDefinition MyXProp = new ExtendedPropertyDefinition(
    DefaultExtendedPropertySet.PublicStrings,
    "MyXProp", MapiPropertyType.String);
    OR
    Guid MyPropertySetId = new Guid("{C11FF724-AA03-4555-9952-FA248A11C3E}");
    ExtendedPropertyDefinition extendedPropertyDefinition = new ExtendedPropertyDefinition(
    MyPropertySetId, "MyXProp", MapiPropertyType.String);
    What are the factors that should dictate the above decision?
    Also what difference it makes by above two approaches?

    1.  Have a read of
    http://blogs.technet.com/b/exchange/archive/2009/04/06/3407221.aspx which explains the history and why's and what's of named properties.
    >>Do we have any Ews API method which can fetch values of all extended properties belonging to the same group on an item?
    No EWS will only return the properties you ask it to return there is no way to enumerate all the extended properties on an Item.
    2. There is no right or wrong answer to this using PS_PUBLIC_STRINGS with a generic propertyname is generally a bad idea because another product could decide to use the same propertyname and you have a clash. So using your own guid can have
    it's advantages. Personally I find working with PS_PUBLIC_STRINGS make things more discoverable and easier to use if you need to integrate further with MAPI or Transport Agents.
    Cheers
    Glen

  • What class sd card to use in lumia 2520?

    What class sd card should be used in the lumia 2520 tablet?

    jones65,
    Jimmyireland is correct. Card rated Class 2, 4, 6, and 10 even the much more faster cards should work just fine with the 2520 as long as it is made by a reputable brand.

  • What chat service should I use?

    I want to chat with someone on a pc/webcam. Should I use YahooChat? I want to have both audio and video chat. The PC is not a .mac member, so I can't use iChat, right?
    Please advise on what I should try. Thanks.
    MacBook   Mac OS X (10.4.8)  

    Hi
    Try Skype to A/V with PC.
    Mac version http://www.skype.com/intl/en-gb/download/skype/macosx/25beta.html
    PC version http://www.skype.com/intl/en-gb/download/skype/windows/helloagain.html
    Tony

  • What sequence setting should I use for a High Quality Video Montage?

    I am about to start a new project for a client using photographs only.  I have two questions:
    1.  What should I use for the sequence settings?  Should I edit with a HD sequence setting? 
    2.  I am going to scan the pics myself.  What Pixel or resolution is appropriate to get the best quality?  I'm looking for wide screen 16 x 9, not 3 x 4.

    First, decde how you are going to deliver this production to your client. Then tell us what that delivery medium will be. Then we'll have some advice for you.
    See the section in the FCP manual on using still images. You need to understand that in video there are only pixels, no dots per inch or lines per inch. Those terms are meaningless in video. You wil sand at a size in raw pixels that is only slightly larger than your delivery format.
    bogiesan

  • What connection-cable should I use to watch films from my iPod on my TV

    What connection should I use to see films from my ipod on my tV?

    Hi there sonofmyfather,
    You can use the Apple Composite AV Cable if you want to connect your iPod Classic to your TV. Take a look at the product page below for more information.
    Apple Composite AV Cable
    -Griff W.

  • What email program should I use?

    I have Safari 1.3.2 which I assume is the final upgrade for 10.3. I changed my browser to Firefox because of some of the problems with Safari. I was a long user of Netscape, including their email program. I want to keep Panther as my operating system. Should I use the Safari 1.3.2 for email? Want would you recommend for email, something different?

    Hi again,
    Yes, the Navigator Composer/Mail bundle... it's a good one if you like it. Has a lot of extra's to it. If you want to check out others, have you tried the one that comes with MacOSX? It's simply called Mail. It's the one I use now... it's simple, has some extra's and is all I need. Some like Microsoft Entourage which comes with the new Mac as a trial and is bundled with the Microsoft Office Suite... if you have that bundle. I find it has much more then I want to be a simple program, maybe some office types could use all that stuff, but I don't.
    Camino is just a browser. SeaMonkey is the Mac version of Netscape... it has all the elements of Navigator... composer, mail, browser and with all the same icons... it is just more Mac-Friendly then Navigator can be. This one would be worth a look if you are used to Netscape (since Netscape is now without support and has been acquired by AOL), and SeaMonkey is still going and improving.
    A stand alone mail program called ThunderBird on the Mozilla web-site is also an alternative if you want something different to try out. I have given it a look, but again it has too many bells and elements for my simple use style.
    So, I have grown used to Mail which is a natural for this Mac... works well, simple and yet some bell's to enhance with. But, you, can now give some others a look/feel and see what you think.
    Enjoy

  • What File Extension Should I Use

    I'm new to websites.  I have been adding documents to our organizations website (thesoba.com).  Usually I will use pdf documents, but one of the documents (points) is taking a long time to load. That document keeps getting bigger and bigger each month.  I think that it's loading about 18 pages.   I know I have a lot of files on the website that I don't use and need to clean those up.  We have sponsor logo's and past history that we want to keep and possibly use in future years.  I need to those to a backup or another folder.  What is the best way to know what files are currently in use on the website.
    Thanks
    Mike

    squatch97401 wrote:
    The files are usually pdf which I have scanned.  I probably did not optimize for the web.  I do have Acrobat pro so I can do just about anything with these files.  Some of these files come from our bowling program.  I'm new to this so should I use another file type to post on the web.
    First off ignore that other guy.  Looks to be a new spam bot.  They appear every so often on forums.
    More than likely if they are just from a scanner they are not optimized.  I'm not sure if PDF is right or wrong.  Best way to tell is to look at the type of data you are trying to store.  If you show me one of the PDFs I would be willing to look at it for you and see whether it is something with optimization or if there is a better way to store the data.  If you are worried about publicly posting one of the documents, we could work through email (I would provide address through that).

  • What PL/SQL should I use?

    I need to:
    1. Grab distinct combination of values from table A,
    2. Check to see that I don't have those records in table B already
    3. If a record exists in B, don't insert
    4. If a record doesn't exist, insert.
    What should I use? Sounds to me like a trigger job, but I read somewhere on the forum that triggers cannot check for dupes.
    Table B's PK is a sys-generated value that I get out of a separate sequence/trigger.
    Can someone, please give me direction?
    Thanks,

    I'm not sure why you'd need PL/SQL at all here... Seems like a pretty straightforward INSERT statement along the lines of
    INSERT INTO b ( list_of_columns )
      SELECT list_of_columns
        FROM a
       WHERE NOT EXISTS(
          SELECT 1
            FROM b
           WHERE a.key = b.key )or
    INSERT INTO b ( list_of_columns )
      SELECT list_of_columns
        FROM a
      MINUS
      SELECT list_of_columns
        FROM bDepending on your data (particularly the presence of NULLs), you may need to tweak this slightly, but it sounds like you can use a single SQL statement.
    Justin

Maybe you are looking for

  • Page cannot be displayed while  running report in OAS (10.1.2.3)form/report

    Hi All, I have a report which take 4 hrs time to execute the report If i run this 4 hrs report,the report runs sucessfully when we see in particular report server in application server. But, we wont get any pop up to open report after executing suces

  • Invoice: Baseline date on the payment terms.

    Dear Experts, I am having a problem where trying to change the term of payment of an invoice before a posting, the account doesnt set the baseline date correctly. This issue occurs for baseline date type 'Entry Date' . After whichever interaction in

  • Regular Expressions, please help.

    Hello everyone. Can I get a Java Regular Expression to match with a word of the following language... Start --> Expression; Expression --> [0-9]+; Expression --> Expression * Expression; So the regexp should match with words like: 4; 4664; 4 * 763; 5

  • Firefox shows my outdated e-mail address when forwarding

    I was trying to forward a petition to other people to sign, but Firefox shows an outdated e-mail address, which I can no longer access because I'm not paying for the service. I have tried overriding the old address with the new one, but it doesn't wo

  • TS1292 como puedo encontrar mi numero de serie de la tarjeta iTunes?

    como puedo activar mi tarjeta de iTunes Store si al poner el codigo me aparece un mensaje que me dice el codigo no esta activo