• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Date class

 
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Date d1 = new Date(1000000000000L);
System.out.println("1st date " + d1.toString() );

The output is 9/8/2001 starting from 01/01/70.

OK. Where is the start date being set?
Why did some decide to start the clock on 01/01/1970? The clock started on my birthday.
 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<quote>Why did some decide to start the clock on 01/01/1970? The clock started on my birthday.
</quote>
In java (it happened in unix too) and some other computing systems a base year is needed. This is to aid computation. UNIX was already following this date known as 'epoch'. Sun decided to use the same - may be to avoid confusion.

Standard base time known as "the epoch" is January 1, 1970, 00:00:00 GMT.

<quote>Where is the start date being set? </quote>
The java.util.Date class in the above context don't keep the base year. When you call the toString method, a DateFormat object computes the String value.
 
Higgledy Smith
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic