J2ME in time to deal with Destination

  Abstract: The time to deal with the J2ME Destination 

  J2ME in time to deal with Destination 

  Author: Chen Yue-feng 

  From: http://blog.csdn.net/mailbomb 

  Time in the development of a common procedure, the time to deal with the following do a simple explanation. 

  First, the expression of time 

  J2ME in time there are two expressions: 

  1, and GMT1970 to January 1, 12:00 and midnight is the difference between a few milliseconds to represent 

  Comparing this way for the difference between the two time. 

  2 to object to the form of expression 

  Second, the time to deal with related 

  J2ME time involved in the three categories: 

  1, Class System 

  Long time = System. CurrentTimeMillis (); 

  The method can be used current time, time for the expression of the above-mentioned first. 

  2, Date of 

  Date date = new Date (); 

  Access to the current time, the use of objects in the form of expression. 

  3, Class Calendar 

  Calendar calendar = Calendar. GetInstance (); 

  Third, time to deal with the specific operation 

  1, the expression of more than three conversion: 

  A) System of the time was converted to Date object 

  Date date = new Date (System. currentTimeMillis ()); 

  B) Date type of object will be converted to an object of type Calendar 

  Calendar calendar = Calendar. GetInstance (); 

  Date date = new Date (); 

  Calendar.setTime (date); 

  2, the date of the completion of some use Calendar operation: 

  Calendar time is the most commonly used is the most powerful category, can be used to be a time of the date of the week, and other information. 

  Date of access: 

  Calendar calendar = Calendar. GetInstance (); 

……

  Int day = calendar.get (Calendar. DATE); 

  Access date, year, and this week a similar operation. 

  It must be noted that: Calendar in the figures and said that in a practical difference, that is, by January the number 0, in February with a figure that…… December with 11 figures said. 

  ↑ Back 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags:

Releated Java Articles

Comments

Leave a Reply