LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2009)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 25 Sep 2009 12:22:20 +1000
Reply-To:   Thara Vardhan <vard1tha@police.nsw.gov.au>
Sender:   "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:   Thara Vardhan <vard1tha@police.nsw.gov.au>
Subject:   Reply - seeking help with extract hours and seconds from date variables
In-Reply-To:   <e07502690909241858r797acadct8e4e1ced79c055b@mail.gmail.com>
Content-Type:   multipart/alternative;

Hi Ariel

Thank you so much for helping me with the syntax problem. However when i tried the syntax you sent I get the result as follows:

time from hour time from sec

7:00 0:00

where as the actual number of hours is 10 hours between

timefrom timeto 07:30:00.00 17:30:29.00

How do i overcome this?

many thanks thara

Ariel Barak <abarakabarak@gmail.com> Sent by: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU> 25/09/2009 11:58 Please respond to Ariel Barak <abarakabarak@gmail.com>

To SPSSX-L@LISTSERV.UGA.EDU cc

Subject Re: seeking help with extract hours and seconds from date variables

Hi Thara,

In this situation, it helps if the variable is a date variable. Using the XDATE commands is your best bet....here is an example.

Compute TimefromHour=XDATE.HOUR(Timefrom). Compute TimefromSecond=XDATE.SECONDS(Timefrom). Execute.

Best, Ari

On Thu, Sep 24, 2009 at 8:47 PM, Thara Vardhan <vard1tha@police.nsw.gov.au > wrote:

Dear list members

I have two date variables - imported from an excel file with the format under format/cell/custom (d/mm/yyyy h:mm) as follows:

Timefrom Timeto 5-Feb-2009 07:30:00.00 5-Feb-2009 17:30:29.00

I have to extract only the number of hours and seconds from each of them. Both the variables are in date format in SPSS.

Do I use the substring function? Will that help if the variable is a date format? I tried to use date/time wizard but was not successful.

I would be grateful if someone could help me with this?

Many thanks

thara

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s) only. It may contain private, confidential, copyright or legally privileged information. If you are not the intended recipient or you have received this email by mistake, please reply to the author and delete this email immediately. You must not copy, print, forward or distribute this email, nor place reliance on its contents. This email and any attachment have been virus scanned. However, you are requested to conduct a virus scan as well. No liability is accepted for any loss or damage resulting from a computer virus, or resulting from a delay or defect in transmission of this email or any attached file. This email does not constitute a representation by the NSW Police Force unless the author is legally entitled to do so.

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

All mail is subject to content scanning for possible violation of NSW Police Force Electronic Messaging Policy. All NSW Police Force employees are required to familiarise themselves with the content of the policy, found under Policies on the NSW Police Force Intranet.

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

The information contained in this email is intended for the named recipient(s) only. It may contain private, confidential, copyright or legally privileged information. If you are not the intended recipient or you have received this email by mistake, please reply to the author and delete this email immediately. You must not copy, print, forward or distribute this email, nor place reliance on its contents. This email and any attachment have been virus scanned. However, you are requested to conduct a virus scan as well. No liability is accepted for any loss or damage resulting from a computer virus, or resulting from a delay or defect in transmission of this email or any attached file. This email does not constitute a representation by the NSW Police Force unless the author is legally entitled to do so.


[text/html]


Back to: Top of message | Previous page | Main SPSSX-L page