Skip to content

ANY ONE HERE PLZ Urgent

2 messages · arun, Mark Sharp

#
Try:

format(as.Date("05/07/2014", "%m/%d/%Y"), "%m")
#[1] "05"

#or
strptime("05/07/2014", "%m/%d/%Y")$mon+1
#[1] 5



A.K.


How to extract a Month from Date object?

almost 13 peoples visited my Question with out replying in New to R , i have task yaar



don't mind plz could you HELP ME

How to extract a Month from Date object?

as.month("05/07/2014", format = "%m")

tried wityh this
#
If you use the lubridate package, this is very easy.
See the help file for month() within lubridate for more examples.

library(lubridate)
x <- now()
month(x)
month(x, label = TRUE)
month(x, label = TRUE, abbr = FALSE)
as.character(month(x, label = TRUE, abbr = FALSE))

When you run the above your get the following.
[1] 8
[1] Aug
Levels: Jan < Feb < Mar < Apr < May < Jun < Jul < Aug < Sep < Oct < Nov < Dec
[1] August
12 Levels: January < February < March < April < May < June < July < ... < December
[1] "August"

Mark
On Aug 28, 2014, at 5:33 AM, arun <smartpink111 at yahoo.com> wrote:

            
NOTICE:  This E-Mail (including attachments) is confidential and may be legally privileged.  It is covered by the Electronic Communications Privacy Act, 18 U.S.C.2510-2521.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution or copying of this communication is strictly prohibited.  Please reply to the sender that you have received this message in error, then delete it.