You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by SUPRIYA MISRA <su...@hotmail.com> on 2002/03/13 15:57:36 UTC

Help with Oracle dates from Secs passed since 1970

If anyone has a ready made solution to convert an UNIX TIME of seconds 
passed 1970 into java or oracle dates, please help.
The number I get is  1001091454 which seconds passed since Jan 1st 1970. 
This needs to be converted to a valid oracle date. The answer will be a date 
in 2001.






_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help with Oracle dates from Secs passed since 1970

Posted by Owen Scott Medd <os...@careersite.com>.
Isn't unix time equivalent to the java date divided by 1000?  I thought
the java date is in milliseconds since Jan 1, 1970.

lol... well, at least that works for us.  We have unix times tucked away
in database fields that we multiply by 1000 to get java dates, like so:

	info.submitdate = new Date( rs.getLong( col++ ) * 1000 );

YMMV.

Owen

On Wed, 2002-03-13 at 09:57, SUPRIYA MISRA wrote:
> If anyone has a ready made solution to convert an UNIX TIME of seconds 
> passed 1970 into java or oracle dates, please help.
> The number I get is  1001091454 which seconds passed since Jan 1st 1970. 
> This needs to be converted to a valid oracle date. The answer will be a date 
> in 2001.
> 
> 
> 
> 
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
-- 
USMail:   Employment Specialists, LLC, 130 S. First, Ann Arbor, MI 48104
Phone:    +1 734 213-9500	FAX:	+1 240 266-2535
mailto:osm@careersite.com	http://www.careersite.com/~osm/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help with Oracle dates from Secs passed since 1970

Posted by keithBacon <ke...@yahoo.com>.
ho ho - do it my way if you get paid by number of lines of code produced!

--- keithBacon <ke...@yahoo.com> wrote:
> Without looking it all up (maybe a bit wrong here).
> convert seconds into days (divide by 60 * 60 * 24) then use java.util.Date or
> GregorianCalendar to add that number of days to 1/1/1970.
> Then grapple with DateFormat objects!!
> I have some totally non-standard date code that I converted from VB after it
> was proved to me there was a nasty bug in java.util.Date. I can't remember
> exactly what the bug was but it made us ditch java dates straight away. I
> never
> saw it mentioned elsewhere but I guess you could assume there is no such bug
> now (or never was & we were mis-guided). You can have my code if you ask,
> wouldn't want to put it on this list - it's un-orthodox & might be held
> against
> me!
> I do believe you should write utility classes for validating/formatting dates
> so that enforce standards across your system. Then you can recode your date
> handling ad-nauseum.
> cheers - keith.
> 
> --- SUPRIYA MISRA <su...@hotmail.com> wrote:
> > If anyone has a ready made solution to convert an UNIX TIME of seconds 
> > passed 1970 into java or oracle dates, please help.
> > The number I get is  1001091454 which seconds passed since Jan 1st 1970. 
> > This needs to be converted to a valid oracle date. The answer will be a
> date 
> > in 2001.
> > 
> > 
> > 
> > 
> > 
> > 
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> > 
> > 
> > --
> > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > 
> 
> 
> =====
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Search the archive:-
> http://www.mail-archive.com/struts-user%40jakarta.apache.org/
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Keith Bacon - Looking for struts work - South-East UK.
> phone UK 07960 011275
> 
> __________________________________________________
> Do You Yahoo!?
> Try FREE Yahoo! Mail - the world's greatest free email!
> http://mail.yahoo.com/
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Help with Oracle dates from Secs passed since 1970

Posted by keithBacon <ke...@yahoo.com>.
Without looking it all up (maybe a bit wrong here).
convert seconds into days (divide by 60 * 60 * 24) then use java.util.Date or
GregorianCalendar to add that number of days to 1/1/1970.
Then grapple with DateFormat objects!!
I have some totally non-standard date code that I converted from VB after it
was proved to me there was a nasty bug in java.util.Date. I can't remember
exactly what the bug was but it made us ditch java dates straight away. I never
saw it mentioned elsewhere but I guess you could assume there is no such bug
now (or never was & we were mis-guided). You can have my code if you ask,
wouldn't want to put it on this list - it's un-orthodox & might be held against
me!
I do believe you should write utility classes for validating/formatting dates
so that enforce standards across your system. Then you can recode your date
handling ad-nauseum.
cheers - keith.

--- SUPRIYA MISRA <su...@hotmail.com> wrote:
> If anyone has a ready made solution to convert an UNIX TIME of seconds 
> passed 1970 into java or oracle dates, please help.
> The number I get is  1001091454 which seconds passed since Jan 1st 1970. 
> This needs to be converted to a valid oracle date. The answer will be a date 
> in 2001.
> 
> 
> 
> 
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Help with Oracle dates from Secs passed since 1970

Posted by Robert Nocera <rn...@neosllc.com>.
You can just convert seconds into milliseconds (*1000) and then use
java.util.Date(milliseconds) to get your date which is Sep 21, 12:57:34
EDT 2001.


Robert Nocera
New England Open Solutions
www.neosllc.com
"You supply the vision, we'll do the rest."
 

-----Original Message-----
From: SUPRIYA MISRA [mailto:supriya_misra@hotmail.com] 
Sent: Wednesday, March 13, 2002 9:58 AM
To: struts-user@jakarta.apache.org
Subject: Help with Oracle dates from Secs passed since 1970

If anyone has a ready made solution to convert an UNIX TIME of seconds 
passed 1970 into java or oracle dates, please help.
The number I get is  1001091454 which seconds passed since Jan 1st 1970.

This needs to be converted to a valid oracle date. The answer will be a
date 
in 2001.






_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>