Description Usage Arguments Details Value Note Author(s) References See Also Examples
DateConversion
was used to read and output the date variable with your preferred format.
1 | DateConversion(DateVar,DateIn,DateOut)
|
DateVar |
Specify your date variable. |
DateIn |
Specify the date format for your original variable,e.g.%m/%d/%Y. |
DateOut |
Specify the date format that you hope to output,e.g.%d/%m/%Y. |
DateConversion
is an easy function to convert a date variable between
different formats,which is very useful for your manipulation on a dataset with
date variables without time inside.
DateConversion
returns the date format that you expected directly.
For dates, More detailes,see above reference.
Zhijie Zhang, epistat@gmail.com
Spector P.Data Manipulation with R.,Springer Science+Business Media,LLC.
2008.(Chapter4:Dates.)
as.POSIX* for Date-time Conversion Functions #as.Date,Sys.Date,POSIXct,POSIXlt #Dates for dates without times. #strptime for conversion to and from character representations. #Sys.time for clock time as a POSIXct object. #difftime for time intervals. #cut.POSIXt, seq.POSIXt, round.POSIXt and trunc.POSIXt for methods for these classes. #weekdays.POSIXt for convenience extraction functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
#Example 1
a<-"10/20/1999"
DateConversion(a,DateIn="%m/%d/%Y",DateOut="%d/%m/%Y")
#Example 2
b<-"27/12/2000"
DateConversion(b,DateIn="%d/%m/%Y",DateOut="%m/%d/%Y")
#Example 3
c<-"20001223"
Date_New1<-DateConversion(c,DateIn="%Y%m%d",DateOut="%m/%d/%Y")
Date_New1
Date_New2<-DateConversion(c,DateIn="%Y%m%d",DateOut="%d/%m/%Y")
Date_New2
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.