Displaying 20 results from an estimated 805 matches for "strptime".
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") ,
"%...
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...
2002 Apr 08
1
Problem(?) in strptime()
...cause
2002-4-7 2:30 GMT truly is 2002-4-6 18:30 PST.
What I need is a way to have that fourth case interpreted correctly.
Investigating a bit:
> ISOdatetime
function (year, month, day, hour, min, sec, tz = "")
{
x <- paste(year, month, day, hour, min, sec)
as.POSIXct(strptime(x, "%Y %m %d %H %M %S"), tz = tz)
}
> strptime
function (x, format)
.Internal(strptime(x, format))
ISOdatetime() uses strptime(), and strptime() does not use the
timezone information. Indeed, from ?strptime, TZ as part of a format
specification is available for output only.
As fa...
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
> | [1] 14.01234
> |
> | Unfortunately for my application it seems to be "greedy", in that it
> | tri...
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"
> strptime("20061201 1:02 PST",format...
2020 Oct 31
2
strptime() keeps emitting warnings after establishing a handler with tryCatch()
Dear list members,
I have come about a peculiar behavior in R (4.0.2) which I would
describe as a bug.
On macOS, where `strptime()` raises a warning for invalid timezone
identifiers, the following code will continue to raise the original
warning with every subsequent call to `strptime()`:
```
# attach a handler for warnings for this call only:
tryCatch(strptime('2020-10-31 18:30', format = '%Y-%m-%d %H:%M',...
2007 Jun 12
1
Can strptime handle milliseconds or AM/PM?
I'm trying to proess date/time fields from files that were given to me to
analyze.
Any clues what I'm doing wrong with strptime? This seems to fail the same
way under Linux or Windows.
For ?strptime would it make sense to explain %OS3 somewhere besides the
Examples?
> # Why does %OS3 work here?
> format(Sys.time(), "%H:%M:%S")
[1] "16:45:19"
> format(Sys.time(), "%H:%M:%OS3")
[1...
2003 Nov 14
5
ISOdate() and strptime()
Dear R-people!
I am using R 1.8.0, under Windows XP.
While using ISOdate() and strptime(), I noticed the following behaviour when
"wrong" arguments (e.g., months>12) are given to these functions:
> ISOdate(year=2003,month=2,day=20) #ok
[1] "2003-02-20 13:00:00 Westeurop?ische Normalzeit"
> ISOdate(year=2003,month=2,day=30) #wrong day, but returns a value...
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 2:00",format="%m/%d/%Y %H:%M"))
[1] TRUE
I've processed an ent...
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...
2006 Mar 07
3
Applying strptime() to a data set or array
...sts 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 140.120
3186 2006-02-28 13:30:00 450.940
3187 2006-02-28 14:00:00 318.570
...
So, I try to convert A$date to a POSIXlt ...
A[,1]<-strptime(A$date,"%Y-%m-%d %H:%M:%s")
A$date<-strptime(A$date,"%Y-%m-%d %H:%M:%s")
which gives me a warning that the length of the array I am trying to
replace A$date with is 9 ... but if I print strptime(A$date,"%Y-%m-%d
%H:%M:%s"), it clearly has thousands of rows. Yet...
2001 Oct 31
4
strptime bug (PR#1155)
...# status
## major 1
## minor 3.1
## year 2001
## month 08
## day 31
## language R
## The beav1 example in *help[R](plot.POSIXct)* shows two bugs.
## The first is a fundamental error in strptime.
##
## The second is two details in the construction of the example.
##
## strptime is not using the "%j" format correctly. This has the effect
## of wrapping the time in the beav1 example. Here is a simplified
## example in which we see that the day wraps.
library(MASS)
da...
2003 Nov 26
4
strptime Usage
...1986" "5/29/1986" "6/15/1986"
[16] "6/18/1986" "6/23/1986" "6/29/1986" "7/16/1986" "7/25/1986"
I'd like to convert it into either yyyy-mm or yyyy/mm form, e.g. 1986-06
or 1986/06, and I've been suggsted to use the strptime() function.
However when I look at the documentation of it and tried something like:
> strptime(as.vector(SLDATX)[1:20], "%y/%m")
[1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
I got a bunch of NA's. I also tried:
> strptime(as.vector(SLDATX)[1:20], "...
2020 Nov 01
0
strptime() keeps emitting warnings after establishing a handler with tryCatch()
...base
loaded via a namespace (and not attached):
[1] compiler_4.0.3
Hope this helps,
Rui Barradas
?s 23:55 de 31/10/20, David Kepplinger escreveu:
> Dear list members,
>
> I have come about a peculiar behavior in R (4.0.2) which I would
> describe as a bug.
> On macOS, where `strptime()` raises a warning for invalid timezone
> identifiers, the following code will continue to raise the original
> warning with every subsequent call to `strptime()`:
>
> ```
> # attach a handler for warnings for this call only:
> tryCatch(strptime('2020-10-31 18:30', forma...
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 and day
> for Sys.time(). I might expect it to se...
2004 Nov 30
4
Unable to understand strptime() behaviour
R V2.0.1 on Windows XP.
I have read the help pages on strptime() over and over, but can't
understand why strptime() is producing the following results.
> v <- format("2002-11-31", format="%Y-%m-%d")
> v
[1] "2002-11-31"
> factor(v, levels=v)
[1] 2002-11-31
Levels: 2002-11-31
> x <- strptime("...
2016 Feb 04
3
Fwd: [musl] strptime() question
There is incompatibility between R strptime and musl libc. I posted
about it on their mailing list, but they need more information I can't
provide, so I'm forwarding the message here in hope R developers can
help. Thanks.
---------- Forwarded message ----------
From: Rich Felker <dalias at libc.org>
Date: Thu, Feb 4, 2016 at...
2004 Feb 04
5
Date Time Conversion problems...
...1/2003,USFi-,3705
"Harrold, Paul",1/10/2003,AP15122,1/13/2003,1/14/2003,FishM,65.06
Old Code:
library(lattice)
data <- read.csv("h:\\list3.csv",header=TRUE)
data2 <-
data.frame(Name=data$UserName,Date=data$RequestDate,Vendor=data$Vendor,Cost=
data$Total)
data2$Date <- strptime(as.character(data2$Date),format="%m/%d/%Y")
start <- strptime(c("1/01/2003"),format="%m/%d/%Y")
end <- strptime(c("12/31/2003"),format="%m/%d/%Y")
data3 <- data2[data2$Date >= start & data2$Date <= end,]
lset(col.whitebg())
xyplot...
2003 May 29
3
Odd behavior of strptime
The example from the help page for strptime has the following oddity:
> dates <- c("02/27/92", "02/27/92", "01/14/92",
+ "02/28/92", "02/01/92")
> times <- c("23:03:20", "22:29:56", "01:03:30",
+ "18:21:...
2003 Nov 25
0
AW: ISOdate() and strptime()
...time that it is necessary to be very careful when
using all these POSIX things.
As another example, here is something that made me scratch my head just
yesterday:
When I create a sequence of days that happens to start before and ends in
daylight savings time, I seem to lose a day:
> seq(from = strptime("20030329", format="%Y%m%d"), to= strptime("20030402",
format="%Y%m%d"), by="DSTday")
[1] "2003-03-29 Westeurop?ische Normalzeit" "2003-03-30 Westeurop?ische
Normalzeit"
[3] "2003-03-31 Westeurop?ische Sommerzeit" "...