r - How to display date in month and year format -
i have date field called date.timestamp in database,which has date values "fri nov 27 20:17:01 ist 2015" .there lot of records having date.timestamp field. need display nov 2015 records in database. how can that?
assuming ist indian standard time, 5:30 hours ahead of coordinated universal time, 1 substitute ist +0530 , use format %z of strptime.
vec <- "fri nov 27 20:17:01 ist 2015" format(strptime(sub("ist", "+0530", vec), "%a %b %d %h:%m:%s %z %y"), "%b %y") # [1] "nov 2015" vec <- c("fri nov 27 20:17:01 ist 2015","mon nov 30 20:17:01 ist 2015") format(strptime(sub("ist", "+0530", vec), "%a %b %d %h:%m:%s %z %y"), "%b %y") # [1] "nov 2015" "nov 2015"
Comments
Post a Comment