Re: [S] Date Conversion

Robin Regnier (RRegnier@centrallimit.com)
Thu, 29 Oct 1998 12:33:39 -0800


Hi,

Firstly, I think the function you want is dates(), not
date(). Using this function requires the syntax
dates("1998/01/01", format="y/m/d").

This means you need to convert your vector from 19980101 to
1998/01/01. I believe there is a section in the user's
guide that shows you how to do this using parse() and
substitute() (don't quote me on this ;) ). I'm really not
up on this stuff right now but one way may be to create
three separate vectors; the first one takes the first 4
characters, the second takes 5-6 characters, and the third
takes the last two. You could then use my.dates <-
paste(x,"/",y,"/",z,sep="") to get the required vector.

I hope this helps by at least giving you a few ideas on how
to tackle the problem.

Robin Regnier
Central Limit Statistical Consulting
RRegnier@CentralLimit.com
http://www.CentralLimit.com

-----Original Message-----
From: PT Quants Group Dir <ptquants@nyptsrv1.etsd.ml.com>
To: s-news@wubios.wustl.edu <s-news@wubios.wustl.edu>
Date: Thursday, October 29, 1998 11:28 AM
Subject: [S] Date Conversion

>Hi,
>
> I have date in '19980101' format and I want to convert
in/out from S+.
>
>date('19980101', format='ymd') does not work
>date( y, 'ymd') results in 980101
>
>Is there a good way to convert it back and forth? And
especially as a vector rather than looping?
>Thanks,
>
>S.Y.,
>-----------------------------------------------------------
------------
>This message was distributed by s-news@wubios.wustl.edu.
To unsubscribe
>send e-mail to s-news-request@wubios.wustl.edu with the
BODY of the
>message: unsubscribe s-news
>

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news