Fw: Re: extract time from date/time field

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fw: Re: extract time from date/time field

John F Hall
 
----- Original Message -----
Sent: Tuesday, December 08, 2009 1:19 PM
Subject: RE: Re: extract time from date/time field

Hi John,

I would carry out the following

 

COMMENT this syntax will take the date_time variable (content like this 14-JUN-2009 19:14:00 and in the date and time format) and deduct the date element from it to leave only the time .

COMPUTE time_only=date_time - (XDATE.DATE(date_time)).

FORMATS time_only (time) .

EXECUTE.

 

It seems to work.

Jacqueline

 

Professor Jacqueline Collier
Tel:   0115 8230817         Mobile:   0771 781 401 8

Secretary   Shali Shah (Mon–Fri 10am-3pm)
[hidden email]
Tel:  0115 8230803       Fax: 0115 823 1208

 

 

----- Original Message -----

Sent: Tuesday, December 01, 2009 8:57 PM

Subject: Re: extract time from date/time field

 


Perhaps a solution has already been found, but a text file ('dates.txt'
containing your test values) and the following syntax worked when read in as
two separate variables...

GET DATA /TYPE=TXT /FILE = 'dates.txt' /DELCASE = LINE /DELIMITERS = " "
         /ARRANGEMENT = DELIMITED /VARIABLES = PART1 DATE10 PART2 TIME.

Regards,

Bob Walker
Surveys & Forecasts, LLC
www.safllc.com

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
Parise, Carol A.
Sent: Saturday, November 28, 2009 6:10 PM
To: [hidden email]
Subject: extract time from date/time field

Greetings,



I have a date/time field containing the following:



14-JUN-2009 19:14:00
14-JUN-2009 22:49:00
14-JUN-2009 18:35:00
14-JUN-2009 18:42:00
14-JUN-2009 21:33:00
15-JUN-2009 01:10:00
14-JUN-2009 23:53:00





I need to extract just the time portion out of this so that it looks like
this:

19:14:00
22:49:00
18:35:00
18:42:00
21:33:00
01:10:00
23:53:00





I don't necessary need to retain the date portion so tried manually changing
the field type to give me hh:mm:ss but was not successful.



Anyone have syntax?



Thanks and happy long weekend.

Carol

=====================
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


This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.