aspose file tools
The moose likes Beginning Java and the fly likes Why doesn't this work (Date/Time conversion) Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Why doesn Watch "Why doesn New topic
Author

Why doesn't this work (Date/Time conversion)

David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
Ok...

I'm writing some code that reads attributes from Active Directory and the attribute value returned is thus:

this.pwdLastSet = 127560719042795072



What I get back is some jacked up date. Try substituting date.getTime() instead of this.pwdLastSet and it still comes back all crazy.
[ March 23, 2005: Message edited by: David Yutzy ]
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
Have a look at the Apache POI project, in particular this. There is a method in there: filetimeToDate(int high, int low), which lets you convert between the windows epoch and the unix epoch.

If you are doing other stuff with windows datatypes, you will probably find other goodies in the POI project.
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
Very useful, but to get what I need, I have to somehow parse the "low" and "high" bits of the 64-bit number returned into 2x32 bit numbers.

Any idea how to do this?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Why doesn't this work (Date/Time conversion)
 
Similar Threads
How to print default date in required format
how to synchronized simpledateformat
How to convert this String into a readable date?
String conversion
date format