0
strptime('16/Oct/2005:07:51:00',format='%d/%b/%Y:%H:%M:%S')
#[1] NA

My R version is 3.0.2 (2013-09-25) and :

strptime('16/2005:07:51:00',format='%d/%Y:%H:%M:%S')
#[1] "2005-11-16 07:51:00"

"Oct" and %b is unsuccessful, and the following is also unsuccessful:

strptime("Mon Oct 28 00:19:35 +0800 2013", format="%a %b %d %H:%M:%S %z %Y")
#[1] NA

sessionInfo()
#R version 3.0.2 (2013-09-25)
#Platform: x86_64-pc-linux-gnu (64-bit)
#locale: 
#[1] LC_CTYPE=zh_CN.UTF-8       LC_NUMERIC=C               LC_TIME=zh_TW.UTF-8       
#[4] LC_COLLATE=zh_CN.UTF-8     LC_MONETARY=zh_TW.UTF-8    LC_MESSAGES=zh_CN.UTF-8   
#[7] LC_PAPER=zh_TW.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
#[10] LC_TELEPHONE=C            LC_MEASUREMENT=zh_TW.UTF-8 LC_IDENTIFICATION=C       

#attached base packages:
#[1] stats     graphics  grDevices utils     datasets  methods   base     

#loaded via a namespace (and not attached):
#[1] tools_3.0.2
Simon O'Hanlon
  • 58,647
  • 14
  • 142
  • 184
fainle
  • 19
  • 4
  • All of those commands worked fine on my R installation. – CHP Nov 12 '13 at 09:05
  • This question appears to be off-topic because it is localized problem – CHP Nov 12 '13 at 09:07
  • I expect the answer is time. – fainle Nov 12 '13 at 09:12
  • @fainle copy/pasting from your code the last example works just fine for me. Please add the output of `sessionInfo()` into your question. I don't agree with the close vote yet. We don't yet know what the problem is (but it is likely to be localised). – Simon O'Hanlon Nov 12 '13 at 09:26
  • @SimonO101 strptime("Tue Nov 12 00:19:35 +0800 2013", format="%a %b %d %H:%M:%S %z %Y") the result is NA, but, I expect the answer is 2013-11-12 00:19:35 – fainle Nov 12 '13 at 09:38
  • 2
    Right. I get the result you obviously expect. Which is why I am *asking* you to edit in the output from `sessionInfo()`. I suspect that you have overwritten your `strptime` function or you have loaded a package that is overwriting it (possibly). If you don't give people more info this will get closed as too localised. – Simon O'Hanlon Nov 12 '13 at 09:46
  • > sessionInfo() R version 3.0.2 (2013-09-25) Platform: x86_64-pc-linux-gnu (64-bit) locale: [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C LC_TIME=zh_TW.UTF-8 [4] LC_COLLATE=zh_CN.UTF-8 LC_MONETARY=zh_TW.UTF-8 LC_MESSAGES=zh_CN.UTF-8 [7] LC_PAPER=zh_TW.UTF-8 LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=zh_TW.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_3.0.2 – fainle Nov 12 '13 at 09:57
  • @SimonO101 ok, i output the sessionInfo() – fainle Nov 12 '13 at 10:01
  • 2
    You are getting NA values due to the your locale, see this [answer](http://stackoverflow.com/questions/13726894/strptime-in-r-works-then-stops-working-and-then-works-again) for solution – Didzis Elferts Nov 12 '13 at 10:11

0 Answers0