Displaying 20 results from an estimated 9000 matches similar to: "as.POSIXct before and after 1970"
2006 Apr 10
3
timeAlign
I use POSIXct for datetimes. Is thee a timeAlign function that I can
use where :
align by year
direction -1 ==> start of this year
direction 1 ==> start of next year
align by week
direction -1 ==> date on last sunday
direction 1 ==> date on next sunday
align by day
direction -1 ==> time at past midnight
direction 1 ==> time at this comming
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')
2010 Sep 03
1
Incorrect formatted output after subtracting non-integer seconds from POSIXt origin
> x<-as.POSIXct("1970-1-1", tz="UTC")-.5
> y<-as.POSIXct("1970-1-1", tz="UTC")+.5
> x==y
[1] FALSE # of course
but x and y "appear" to be the same when formatted, even with extra
precision:
> format(x, format="%Y-%m-%d %H:%M:%OS2")
[1] "1970-01-01 00:00:00.50"
> format(y, format="%Y-%m-%d
2011 May 27
0
lubridate, as.POSIXct and a vector of times: bug or feature??
It took me some time to realize this annoying behavior was coming from
lubridate.
Perhaps this behavior is unexpected a result of cursory knowledge of it....
## The expected behavior
> sometimes=c(0,1,2,3)*60*60*24
> as.POSIXct( sometimes, origin='1970-01-01', tz='GMT')
[1] "1970-01-01 GMT" "1970-01-02 GMT" "1970-01-03 GMT" "1970-01-04
2013 Apr 17
1
POSIXt oddness at end of 1969
A user here noticed the following difference between Linux and Windows versions
of R-2.15.3 (and R-3.0.0, I think) when using times within a second of the end of 1969:
f <- function (sec = -1)
{
x1 <- as.POSIXct(c(2 * sec, sec, 0), origin = "1970-01-01", tz = "UTC")
x2 <- as.POSIXlt(x1)
x3 <- as.POSIXct(x2, origin = "1970-01-01", tz =
2018 Oct 09
1
Buglet in handling times in R-3.5.1
Dear R developers,
I have found a minute bug in R-3.5.1 (Windows version), about how times not an exact number of seconds are displayed.
> as.POSIXct("1969-01-01 01:00")+0.3
[1] "1969-01-01 01:00:01 CET"
> as.POSIXct("1970-01-01 01:00")+0.3
[1] "1970-01-01 01:00:00 CET"
So for 1969, adding 0.3 of a second means you round UP, for 1970 you round DOWN.
2013 Jan 11
1
Date time conversion bug (as.POSIXct)?
There is something wrong, I think, with the date-time conversion from a
numeric value if you use Central European Time (CET) as timezone.
Examples from R:
If I use the GMT time zone it is OK, I get the same time back from
as.POSIXct as I entered
> as.POSIXct(as.numeric(strptime("30/01/2012 13:00:00", format="%d/%m/%Y
>
2012 Jul 09
1
c(a, b) for POSIXct objects with tzone attributes?
Hello:
What is the recommended method for retaining the tzone attributes
when concatonating POSIXct objects?
> (d1 <- ISOdate(1970,1,1)) # Sets the tzone attribute = GMT
[1] "1970-01-01 12:00:00 GMT"
> (d1.2 <- c(d1, d1)) # c(..) strips the tzone attribute, displays in
the time zone of the operating system
[1] "1970-01-01 04:00:00 PST" "1970-01-01
2012 Jul 19
1
as.POSIXct questions
The following three calls all produce the same result (my machine is in EST):
> as.POSIXct(0, tz="", origin=ISOdatetime(1970,1,1,10,0,0))
[1] "1970-01-01 10:00:00 EST"
> as.POSIXct(0, tz="EST", origin=ISOdatetime(1970,1,1,10,0,0))
[1] "1970-01-01 10:00:00 EST"
> as.POSIXct(0, tz="GMT", origin=ISOdatetime(1970,1,1,10,0,0))
[1]
2012 Jan 27
2
PosixCT subsecond accuracy
A sample of the data I have is:
> head(sensor)
logged_on accx accy accz compassx compassy compassz
gyrox gyroy gyroz
1 1326561428000 -0.4602 0.8346 0.0936 0.145508 -0.350586 0.259766
59.617390 28.521740 59.617390
2 1326561428050 -0.4212 1.0452 0.1326 0.219727 -0.321289 0.241211
88.695656 27.478260 88.695656
3 1326561428100 -0.2496 1.3416 0.2886 0.214844 -0.326172
2011 May 31
3
DateTime Math in R - POSIXct
Greetings -
I'm battling POSIXct, as per the code below. My input is actually an XL
file, but the weird results below correctly model what I am seeing in my
program.
Before I punt and use lubridate or timeDate, could anyone please help me
understand why POSIXct forces my variable back to GMT?
I suspect that I'm not properly coding the tzone value, but it does not
throw an
2009 Feb 27
0
POSIXlt, POSIXct, strptime, GMT and 1969-12-31 23:59:59
R-devel:
Some very inconsistent behavior, that I can't seem to find documented.
Sys.setenv(TZ="GMT")
str(unclass(strptime("1969-12-31 23:59:59","%Y-%m-%d %H:%M:%S")))
List of 9
$ sec : num 59
$ min : int 59
$ hour : int 23
$ mday : int 31
$ mon : int 11
$ year : int 69
$ wday : int 3
$ yday : int 364
$ isdst: int 0
- attr(*, "tzone")= chr
2003 Jan 22
1
Convert numeric value to POSIXct
Hi,
How do I convert a numeric value indicating the time since 1970, back into
a POSIXct class object? I have tried format.POSIXct and as.POSIXct
without success.
For example
> ccc
[1] "1945-01-01 15:00:00 MDT"
> ddd<- as.numeric(ccc);
> ddd
[1] -788842800
> format.POSIXct(ddd)
Error in format.POSIXct(ddd) : wrong class
> as.POSIXct(ddd)
Error in
2003 Feb 21
1
POSIX problem in New Zealand (PR#2570)
Full_Name: Arni Magnusson
Version: 1.6.2
OS: Windows XP
Submission from: (NULL) (210.48.49.68)
Hi there. I'm experiencing unexpected behaviour from as.POSIXct:
> as.POSIXct("1969-12-24")
[1] "1969-12-23 23:00:00 New Zealand Standard Time"
> as.POSIXlt("1969-12-24")
[1] "1969-12-24"
> as.POSIXlt("1969-12-24")+1
[1] "1969-12-23
2013 May 01
1
Windows, format.POSIXct and character encodings
Hi all,
In what encoding does format.POSIXct return its output? It doesn't
seem to be utf-8:
Sys.setlocale("LC_ALL", "Japanese_Japan.932")
times <- c("1970-01-01 01:00:00 UTC", "1970-02-02 22:00:00 UTC")
ampm <- format(as.POSIXct(times), format = "%p")
x <- gsub(">", "*", paste(ampm, collapse =
2011 Jan 07
1
POSIXct issue
Hello I have trouble getting my original datetime back see below. I hope I
am missing something. Please help.
> tt <- as.POSIXct("2011-01-07 07:49:13", tz="EST")
> tt
[1] "2011-01-07 07:49:13 EST"
> ttn <- as.numeric(tt)
> ttn
[1] 1294404553
> tt <- as.POSIXct(ttn,origin='1970-01-01',tz="EST")
> tt
[1] "2011-01-07
2012 Jan 19
2
POSIXct value display incorrect for some values
First, the reproducable example, showing how converting from character to
POSIXct to character changes the milliseconds in the first time stamp
though not in the second:
> as.POSIXct('2010-06-03 9:03:58.324')
[1] "2010-06-03 09:03:58.323 PDT"
> as.POSIXct('2010-06-03 9:03:58.325')
[1] "2010-06-03 09:03:58.325 PDT"
This seems to be due to truncation of
2010 Sep 24
1
POSIXct: Extract the hour for a list of elements
Hi,
I have a list/data.frame 'pk' of POSIXct dates, and I'd like to extract the
hour for each row. I know that if I have an individual POSIXct object, I
can extract the hour by converting to a new object with:
new.lt <- as.POSIXlt(<single POSIXct object>)
new.lt$hour
But I can't figure out how to apply this for a list of such dates in a
vectorized form. I can write a
2023 Apr 28
1
range() for Date and POSIXct could respect `finite = TRUE`
A tiny nit-pick: Seems to me that end date = NA would mean the event has
not yet ended, whilst Inf would mean that the event is known to never
terminate, ie: an eternal fact, or physical law.
On Fri, Apr 28, 2023 at 10:12?AM Davis Vaughan via R-devel <
r-devel at r-project.org> wrote:
> Hi all,
>
> I noticed that `range.default()` has a nice `finite = TRUE` argument,
> but it
2012 Dec 13
1
duplicated.data.frame() and POSIXct with DST shift
Hi,
I encountered the behavior, that the duplicated method for data.frames gives "false positives" if there are columns of class POSIXct with a clock shift from DST to standard time.
time <- as.POSIXct("2012-10-28 02:00", tz="Europe/Vienna") + c(0, 60*60)
time
[1] "2012-10-28 02:00:00 CEST" "2012-10-28 02:00:00 CET"
df <-