similar to: Can strptime handle milliseconds or AM/PM?

Displaying 20 results from an estimated 5000 matches similar to: "Can strptime handle milliseconds or AM/PM?"

2013 Jan 17
1
Can strptime handle milliseconds or AM/PM?
Readers, Responding to an old post (http://tolstoy.newcastle.edu.au/R/e2/help/07/06/18850.html), and using the example in the manual: monthextract<-strptime("20/2/06 11:16:16.683", "%m") monthextract [1] NA Why is the result 'NA' and not '2'? -- r2151
2011 Feb 15
2
strptime format = "%H:%M:%OS6"
I read a dataset with times in them, e.g., "09:31:29.18761". I then parse them: > all$X.Time <- strptime(all$X.Time, format = "%H:%M:%OS6"); and get a vector of NAs (how do I check that except for a visual inspection?) then I do > options("digits.secs"=6); > all$X.Time <- strptime(all$X.Time, format = "%H:%M:%OS"); and it, apparently, works:
2011 May 12
2
How to extract information from the following dataset?
Hi all, I have never worked with this kind of data before, so Please help me out with it. I have the following data set, in a csv file, looks like the following: Jan 27, 2010 16:01:24,000 125 - - - Jan 27, 2010 16:06:24,000 125 - - - Jan 27, 2010 16:11:24,000 176 - - - Jan 27, 2010 16:16:25,000 159 - - - Jan 27, 2010 16:21:25,000 142 - - - Jan 27, 2010 16:26:24,000 142 - - - Jan 27, 2010
2013 Feb 17
0
strptime() with format %OS does not print millisecs in MacOS
Hi! I'm finding this on MacOS Lion 10.7.5 > getOption("digits.secs") NULL > a <- "2012_10_01_14_13_32.445" > strptime(a,format="%Y_%M_%d_%H_%M_%OS") [1] "2012-02-01 14:13:32" > strptime(a,format="%Y_%M_%d_%H_%M_%OS3") [1] NA I can solve it with > options(digits.secs=3) > strptime(a,format="%Y_%M_%d_%H_%M_%OS")
2010 May 24
2
AM/PM strptime %p failing 2.11.0 WinXP
I am attempting to import dates in the following format to R: 5/20/2010 6:45:32 PM Unfortunately I am unable to get the AM/PM function (%p) to work correctly under either 2.11.0 or 2.8.1. > strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p") [1] NA but > strptime("5/20/2010 6:45:32", "%m/%d/%Y %I:%M:%S") [1] "2010-05-20 06:45:32"
2010 Apr 22
2
time difference
Hi, Does anyone know how to take a time difference when the format of the time is as 13:22:23.586? I am trying to take the difference of time between stock transactions and need to keep the three decimal places for seconds. I have tried *diff(strptime(x, "%H:%M:%S.000))*, but apperantly that doesn't work. Carol Gao [[alternative HTML version deleted]]
2008 May 30
3
Strptime
Hi This code should explain what I'm trying to do > strptime("30-Jan-08", "%d-%b-%y") [1] "2008-01-30" > > format(strptime("30-Jan-08", "%d-%b-%y") , "%b-%y") [1] "Jan-08" > > strptime(format(strptime("30-Jan-08", "%d-%b-%y") , "%b-%y") , "%b-%y") [1] NA I have a
2007 Jan 08
1
Does strptime(...,tz="GMT") do anything?
Hi All In trying to correlate some tide gauge data I need to deal with varying timezones. From the documentation on strptime, it seemed that the tz variable might have some effect on the conversion, but I'm not seeing an effect. > strptime("20061201 1:02 PST",format="%Y%m%d %H:%M",tz="PST")+0 [1] "2006-12-01 01:02:00 EST" >
2011 Jul 06
1
trouble parsing a date using strptime()
Hi, I am having a trouble parsing dates using strptime() that I get in the format of year and week number. The data looks like this "201127" which means year 2011 and week 27. I would like to graph this using ggplot but then I get a gap between 201054 and 201101 so I thought I would just easily convert it. I tried to use strptime and as.Date and the format string of %Y%W but it seems
2017 Jan 17
1
strptime("1","%m") returns NA
Hi Frederik, On Mon, 2017-01-16 at 18:20 -0800, frederik at ofb.net wrote: > Hi R Devel, > > I wrote some code which depends on 'strptime' being able to parse an > incomplete date, like this: > > > > > base::strptime("2016","%Y") > [1] "2016-01-14 PST" > > The above works - although it's odd that it gives the month
2006 Apr 15
1
strptime failure R 2.2.1 (PR#8773)
Full_Name: Bill Hutchison Version: 2.2.1 OS: Windows XP Submission from: (NULL) (69.158.121.13) example(strptime) produces the following error: Error in strptime(x, "%d%b%Y") : 2 arguments passed to 'strptime' which requires 3 This error occurs wherever strptime is used. It does not occur in 2.2.0
2011 Feb 08
3
strptime "March 14 2010" and NA?
Converting date strings that range between Mar-14-2010 2:00 and Mar-14-2010 2:59 (inclusive) to date objects (POSIX) returns a NA entity: > strptime("3/14/2010 2:00",format="%m/%d/%Y %H:%M") [1] "2010-03-14 02:00:00" This looks fine, however other functions such as plot see a NA object instead: > is.na(strptime("3/14/2010
2011 Jun 17
1
issue with strptime
Hi everyone, I have bunch of date and time observations in the format %Y-%m-%d %I %M %S %p. I used strptime() to read this format. But the problem is some of the times are in the format of %I %M %p, so for those times, strptime is giving me NA values. For example, strptime(paste("2009-04-08","1:49:47 PM"),format="%Y-%m-%d %I:%M:%S %p") [1] "2009-04-08
2017 Jan 11
2
bug with strptime, %OS, and "."
On Tue, Jan 10, 2017 at 08:13:21PM -0600, Dirk Eddelbuettel wrote: > > On 10 January 2017 at 17:48, frederik at ofb.net wrote: > | Hi R Devel, > | > | I just ran into a corner case with 'strptime'. Recall that the "%OS" > | conversion accepts fractional seconds: > | > | > strptime("17_35_14.01234.mp3","%H_%M_%OS.mp3")$sec > |
2002 Apr 08
1
Problem(?) in strptime()
I think the following examples illustrate the crux of the matter (version and OS info are below). The problem has to do with the transition from standard time to daylight savings time. My timezone, US/Pacific, has two parts: standard time (PST) 8 hours behind GMT and daylight savings time (PDT) 7 hours behind GMT. The transition takes place this year on 7 April at 02:00, when 02:00 is
2012 Jul 10
1
Negative years with strptime?
Is there a way to make as.Date() and strptime() process strings with negative years? It appears that Date objects can contain negative years and you can convert them to strings, but you can't convert them back to Date objects. x <- as.Date(c("0001-01-24", "0500-01-24")) as.character(x) # "0001-01-24" "0500-02-02" as.Date(as.character(x)) #
2006 Mar 07
3
Applying strptime() to a data set or array
I'm sure this is just the result of a basic misunderstanding of the syntax of R, but I am stumped. A <- read.table(file="sumByThirtyMinute.csv",sep=",",col.names=c("date","pandl")) A now consists of thousands of rows, but A$date is a string... ... 3183 2006-02-28 12:00:00 548.470 3184 2006-02-28 12:30:00 515.240 3185 2006-02-28 13:00:00
2017 Jan 11
4
bug with strptime, %OS, and "."
Hi R Devel, I just ran into a corner case with 'strptime'. Recall that the "%OS" conversion accepts fractional seconds: > strptime("17_35_14.01234.mp3","%H_%M_%OS.mp3")$sec [1] 14.01234 Unfortunately for my application it seems to be "greedy", in that it tries to parse a decimal point which might belong to the rest of the format: >
2020 Nov 01
0
strptime() keeps emitting warnings after establishing a handler with tryCatch()
Hello, I cannot reproduce this behavior and, as documented, the posted code doesn't issue warnings due to a wrong timezone but I'm running sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.1 LTS Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK:
2003 Nov 12
1
value of strptime in R 1.8.0
Dear R-people! I am using R 1.8.0, under Windows XP. What I want to do is a date conversion of a character column of a data frame and assign the result as a new column. Simple example: > x <- data.frame(a=c("yesterday","today","tomorrow"), b=I(c("20031111", "20031112", "20031113"))) # convert x$b from character to date: >