Date conversion question...not the excel problem or string issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Date conversion question...not the excel problem or string issue

cfishernyc
I've tackled other date conversion issues before, but this one has me stumped.

I have a bunch of dates in a file sent to me that are displaying as random 6 digit numbers such as 155537

That's obviously not a date, and the date should be somewhere in 2009 or 2010, so I can't figure out how to get there.

I've done the excel approach:

COMPUTE date1=date.dmy(1,1,1900)+ (var1-2)*60*60*24

and that ends up giving me dates in the future like 2310.

Any help would be greatly appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Date conversion question...not the excel problem or string issue

Barnett, Adrian (DECD)
Hi
This is a long shot, but it could be that the date is a number of days. SPSS expresses dates internally as the number of seconds since 14 Oct 1582. Your number is way to small to be seconds, but if we try it as days, it gives promising-looking results:

So, if we divide by 365.2425 we get 425.845 years.

Add that to 1582 and you get 2007.845 . So your example could represent a date in 2007.

Obviously you'd have to experiment and try to verify your results by getting the person who sent you the file to tell you what a few of the date values are.  Anyway, it's somewhere to start.

Regards

Adrian Barnett
Project Officer
Educational Measurement and Analysis
Data and Educational Measurement
DECS
ph 82261080

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of cfishernyc
Sent: Tuesday, 13 July 2010 6:46 AM
To: [hidden email]
Subject: Date conversion question...not the excel problem or string issue

I've tackled other date conversion issues before, but this one has me
stumped.

I have a bunch of dates in a file sent to me that are displaying as random 6
digit numbers such as 155537

That's obviously not a date, and the date should be somewhere in 2009 or
2010, so I can't figure out how to get there.

I've done the excel approach:

COMPUTE date1=date.dmy(1,1,1900)+ (var1-2)*60*60*24

and that ends up giving me dates in the future like 2310.

Any help would be greatly appreciated.
--
View this message in context: http://old.nabble.com/Date-conversion-question...not-the-excel-problem-or-string-issue-tp29144081p29144081.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Date conversion question...not the excel problem or string issue

cfishernyc
Thanks for your help...we'll give that a go and see what happens. I was
trying all sorts of conversion formulas but didn't think about days.

-----Original Message-----
From: Barnett, Adrian (DECS) [mailto:[hidden email]]
Sent: Monday, July 12, 2010 6:14 PM
To: Fisher, Christopher (DJJ); [hidden email]
Subject: RE: Date conversion question...not the excel problem or string
issue

Hi
This is a long shot, but it could be that the date is a number of days.
SPSS expresses dates internally as the number of seconds since 14 Oct
1582. Your number is way to small to be seconds, but if we try it as
days, it gives promising-looking results:

So, if we divide by 365.2425 we get 425.845 years.

Add that to 1582 and you get 2007.845 . So your example could represent
a date in 2007.

Obviously you'd have to experiment and try to verify your results by
getting the person who sent you the file to tell you what a few of the
date values are.  Anyway, it's somewhere to start.

Regards

Adrian Barnett
Project Officer
Educational Measurement and Analysis
Data and Educational Measurement
DECS
ph 82261080

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
cfishernyc
Sent: Tuesday, 13 July 2010 6:46 AM
To: [hidden email]
Subject: Date conversion question...not the excel problem or string
issue

I've tackled other date conversion issues before, but this one has me
stumped.

I have a bunch of dates in a file sent to me that are displaying as
random 6 digit numbers such as 155537

That's obviously not a date, and the date should be somewhere in 2009 or
2010, so I can't figure out how to get there.

I've done the excel approach:

COMPUTE date1=date.dmy(1,1,1900)+ (var1-2)*60*60*24

and that ends up giving me dates in the future like 2310.

Any help would be greatly appreciated.
--
View this message in context:
http://old.nabble.com/Date-conversion-question...not-the-excel-problem-o
r-string-issue-tp29144081p29144081.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command SIGNOFF SPSSX-L For a list
of commands to manage subscriptions, send the command INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD