• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Any Hint?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,
I don't have any idea y I am unable to get zero hours difference when I invoke the method getTimeInMillis() method with epoch time itslef.
this is the pice of code I am using:-

public class ElapsedTime{
public long getEpoch(int yr int month,int date){
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(year,month,date,00,00,00);
return cal.getTimeInMillis();
}
public static void main(String[] args){
ElapsedTime ob = new ElapsedTime();
ob.getEpoch(1970,00,01);
}
}
If i run this code I am getting a difference of 6hrs .. am I missing something?.. could some one please help me ..
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The calendar is using your local timezone (central standard, so it seems), *except* for the getTimeInMillis method, which works based on UTC.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic