Displaying 20 results from an estimated 10000 matches similar to: "Date time conversion bug (as.POSIXct)?"
2003 Sep 02
1
convert character to POSIXct
Dear list-members,
I would like to calculate the difference between two points in time. To convert a 'time (GMT)'-character with the format "1/1/1999 01:01:01" into an object of class "POSIXct"', I first use the strptime() as suggested in the details help(as.POSIXct).
e.g.
starttime<-strptime("1/1/1999 01:01:01",format="%d/%m/%Y %H:%M:%S")
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 2:07 PM
Subject: Re: [musl] strptime() question
To: Alba
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
2004 Aug 18
1
Fwd: strptime() problem? - Resolved
Hi Gabor and everybody;
Thanks Gabor, with the alternative step you've told me the problem is
resolved. Comparing the two procedures:
Extract from the source 'character' data:
> rain$ts[2039:2046]
[1] "25/03/2000 22:00:00 UTC" "25/03/2000 23:00:00 UTC"
[3] "26/03/2000 00:00:00 UTC" "26/03/2000 01:00:00 UTC"
[5] "26/03/2000 02:00:00
2012 Jul 02
1
Undocumented behavior around daylight savings time?
Apologies for the intrusion. I am a lurker on list.
I have been working to convert a digitized signal from a matlab file into R
for analysis and other applications. R.matlab is working fine, and it is
easy to convert the matlab date-time number (days since year 0) into R
date-time numbers (seconds since 1970-01-01).
Unfortunately, when I cast the R date-time number into POSIXct format it
seems
2006 Oct 27
2
POSIXct time zone and daylight savings issues
Hello,
Suppose we need a function that takes a POSIXct object and need to
calculate the time difference between it and GMT time:
gmtDiff <- function(time) {
time.gmt <- as.POSIXct(format(time, tz="GMT"))
time.plt <- as.POSIXlt(time)
dlstime <- ifelse(time.plt$isdst > 0, 1, 0)
timezone <- as.numeric(difftime(time, time.gmt, units="hours"))
2012 May 30
1
fractional seconds in POSIXct
Hi,
Using the following simple character vector representing a time series
with fractional seconds:
datetime <- c("20/09/2011 13:00:59.00", "20/09/2011 13:00:59.02",
"20/09/2011 13:00:59.04")
Conversion to POSIXct runs into problems; the second element is not
interpreted correctly:
---<--------------------cut
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"
>
2002 Apr 08
1
Problem(?) in strptime() -- short version
I decided my earlier email on this topic was rather long and wordy;
here's a condensed version.
I am sitting at a Solaris computer in the US/Pacific timezone.
I have a file of data having times that includes the following three values
2002-4-7 1:30:00 GMT
2002-4-7 2:30:00 GMT
2002-4-7 3:30:00 GMT
I have not been able to find a way to correctly convert these to
either of the POSIX
2003 Jan 03
4
as.POSIXct problem?
Under
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 6.1
year 2002
month 11
day 01
language R
> x <- strptime(c('10/10/1969','12/31/2002'),format='%m/%d/%Y')
2005 Dec 05
1
Automatic time zone conversion
Dear R-help,
I was trying to convert a date and time record extracted from a fortran
subroutine I worte and I encounter some problem. The data read in time
and date in a format like "2000-05-11_01:00:00.0000" in fortran output.
It is in GMT. I need to convert it to CST (GMT+8). I did the following
steps.
> cdate
[1] "2000-05-11_01:00:00.0000\005\003"
# I am not sure
2007 Apr 04
1
time zone problems
Folks,
I'm having trouble with how datetime objects with time zones are set
and plotted. This may be the result of my running R (2.4.0) on a
Windoze XP box. Perhaps not. Here are two example problems I need
advise on if you have time:
1) I collect data with dates (often as a fractional day of year) in
UTC. Using strptime to create date time objects appears to force the
data into
2004 Jun 02
2
Bug with date 1970-01-01 on Windows (PR#6929)
Full_Name: Martin Lenze
Version: 1.8.0 alpha (2003-09-18)
OS: Microsoft Windows 2000 [Version 5.00.2195], SP4
Submission from: (NULL) (82.82.76.131)
Seems to be related to PR#1332...
Hello,
I get:
> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=English_United States.1252"
>
2008 Dec 09
3
difftime
Hi. I'm trying to take the difference in days between two times. Can
you point out what's wrong, or suggest a different function? When I
try the following code, The following code works fine:
a <- strptime(1911100807,format="%Y%m%d%H",tz="GMT")
b <- strptime(1911102718,format="%Y%m%d%H",tz="GMT")
x <- difftime(b, a,
2007 Aug 08
2
Error: Cannot Coerce POSIXt to POSIXct when building package
A newbie here - please forgive me if this is a basic question. We have an
in house package built in R 2.2.1 (yes we're a little behind the times at
our firm)and would like to rebuild it using R 2.5.1. However, when I try
and build the package from source, I keep getting this error:
Error in as(slotVal, slotClass, strict = FALSE) :
no method or default for coercing "POSIXt"
2005 Feb 18
1
creating POSIXct dates in C
I'm trying to generate POSIXct times in a call to a C function.
However, I'm having trouble generating times with the proper offset from
UTC.
Can anyone offer any help with this issue?
I've looked at R-2.0.1/src/main/datetime.c, but I was not able to find
an example that I could easily pull from that file.
Thanks in advance,
Whit
Here is my example in C:
#include <stdio.h>
2006 May 21
1
POSIX, time zone and Windows
Dear Listers,
Apologize to pile up on the 'tz' issue in POSIX objects. I have a
'simple' thing on which I must make up my mind but cannot do it from the
existing R-help threads. I am currently working on dog telemetry in
China, and download time information from GPS collars. I would like to
set up the corresponding POSIXxx variables in R to a given time zone. Eg
Pekin
2017 Apr 06
3
as.POSIXct character string is not in a standard unambiguous format
Hi Ben
Thanks for your answer
I have already tried this, as well as
x <- as.POSIXct(strptime("2002-02-02 02:02", "%Y-%m-%d %H:%M"))
It works! But it does not fix it widely for all tests used during the
"make check" step at compile time. Unless I patch all of them.
There is something with localtime but I cannot find what.
On another machine with another
2010 Apr 22
1
segfault with format.POSIXct()
Hi,
I'm getting a segmentation fault as follows:
---<--------------------cut here---------------start------------------->---
R> begt <- as.POSIXct(strptime("10/01/2009 06:00:00", format="%d/%m/%Y %H:%M:%S"),
+ tz="GMT")
R> tser <- seq(begt, by=5, length.out=91000)
R> tser.trunc <- format(tser)
Error: segfault from C
2004 Aug 17
3
Fwd: strptime() problem?
Hi all;
I've already send a similar e-mail to the list and Prof. Brian Ripley
answered me but my doubts remain unresolved. Thanks for the clarification,
but perhaps I wasn't clear enough in posting my questions.
I've got a postgres database which I read into R. The first column is
Timestamp with timezone, and my data are already in UTC format. An 'printed'
extract of R