Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date function issue with strptime $mon not working in R

Tags:

time

r

Can anyone explain this....

>strptime("19300307", "%Y%m%d")
   "1930-03-07"
>unlist(strptime("19300307", "%Y%m%d"))
   sec   min  hour  mday   mon  year  wday  yday isdst 
    0     0     0     7     2    30     5    65     0 

All of a sudden my strptime is confusing me... Why is mon = 2 rather than 3?

like image 846
mmann1123 Avatar asked Jan 18 '26 01:01

mmann1123


1 Answers

Following my comment, if you read ?DateTimeClasses, you'll see that for POSIXlt we have:

0–11: months after the first of the year.

like image 159
joran Avatar answered Jan 20 '26 17:01

joran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!