strptime("10/16/2011 9:08",format="%m/%d/%Y %H:%M")
私のために働く。あなたは(1)%Y
を4桁の年に大文字にする必要があります。 $ M
ではなく、(2)%M
(これはあなたの質問のタイプミスですか? (3)no seconds(%S
)フィールドにデータがない場合は、 (4)データに1つもない場合は、AM/PMフィールド(%r
)はありません。
edit: with the new data above,
strptime("10/16/2011 9:08:21 PM",format="%m/%d/%Y %r")
strptime("10/16/2011 9:08:21 PM",format="%m/%d/%Y %H:%M:%s %p")
どちらも私のために働く。
Note: the formats are definitely case-sensitive (e.g. %y
vs %Y
matters) and may be locale-sensitive as well. According to ?strptime
, %D
expands to %m/%d/%y
, which would (I think) fail because it's looking for a 2-digit year.