Dennis,
I don’t know if there is an easy way
to do that. But here is one way if we use the Splus function “date”.
######### Write a function of your
own using the Splus function “date”
mytoday_function() {
tdate_as.character(date())
dates(paste(substring(tdate, 5,
10),substring(tdate, 25),sep=" "), format="mon dd yyyy")
}
######## You can compare the dates
using the following command
as.numeric(mytoday())<as.numeric(dates("01/14/2008"))
as.numeric(mytoday())<as.numeric(dates("01/16/2008"))
Hope this helps.
Max
From:
s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On
Behalf Of Dennis Fisher
Sent: Tuesday, January 15, 2008
1:03 PM
To: s-news@lists.biostat.wustl.edu
Subject: [S] Comparing today's
date to a particular date
Colleagues,
I would like to compare today's date to a particular date, e.g., next
January 1. In R, you could do something like:
as.numeric(Sys.Date())
< as.numeric(as.Date("2009-01-01"))
However, fewer time-related commands are available in S-Plus.
Does anyone have a quick fix to this?
Dennis Fisher MD
P < (The "P Less
Than" Company)
Phone: 1-866-PLessThan
(1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com