Questions tagged [posixlt]

Class `POSIXlt` more conveniently represents the result of Class `POSIXct` (the number of seconds since the beginning of 1970) as a numeric vector of more directly accessable values for seconds, minutes, hours, days, months, years etc.

Class POSIXct represents the (signed) number of seconds since the beginning of 1970 (in the UTC time zone) as a numeric vector. Class "POSIXlt" is a named list of vectors representing

sec - 0–61: seconds.

min - 0–59: minutes.

hour - 0–23: hours.

mday - 1–31: day of the month

mon - 0–11: months after the first of the year.

year - years since 1900.

wday - 0–6 day of the week, starting on Sunday.

yday - 0–365: day of the year.

isdst - Daylight Saving Time flag. Positive if in force, zero if not, negative if unknown.

zone - (Optional.) The abbreviation for the time zone in force at that time: "" if unknown (but "" might also be used for UTC).

gmtoff - (Optional.) The offset in seconds from GMT: positive values are East of the meridian. Usually NA if unknown, but 0 could mean unknown.

151 questions
0
votes
1 answer

Converting date in For Loop in R - origin must be supplied

I have a sequence of dates in R, and for each date I need to get the year, month, and day. I tried to use the strftime function to print out the year, but R behaves very strangely. This code fails: # sequence of dates dates <-…
jirikadlec2
  • 1,256
  • 1
  • 23
  • 36
0
votes
1 answer

Unwanted Repetition when adding Hours to POSIX object

I am reading a time series data from files into R data frame. See below the column with dates . I am only showing for year 2009 because here i am getting a problem which i am describing below. it looks quite usual till here. data: >…
Jio
  • 578
  • 3
  • 8
  • 27
0
votes
1 answer

why local time dosen't work? POSIXct in specific time zone [R]

the time my data are in EST time zone, and I try to use this time zone. I want to count the week (in local time, not GMT), so I manually define an originTime in EDT originTime = as.POSIXlt('2000-01-02 00:00:00 EDT') dt2 =…
YJZ
  • 3,934
  • 11
  • 43
  • 67
0
votes
0 answers

strptime does not convert certain dates

I try to convert three dates from character to strptime Using times1 times1 <- c("26/Mar/2015 12:47:27", "28/Mar/2015 13:15:59", "31/Mar/2015 10:05:26") # times1 # >[1] "26/Mar/2015 12:47:27" "28/Mar/2015 13:15:59" "31/Mar/2015 10:05:26" #…
rmuc8
  • 2,869
  • 7
  • 27
  • 36
0
votes
1 answer

R: Posix (Unix) Time Crazy Conversion

Unix time is 1435617000. as.Date(1435617000,origin="01-01-1970") [1] "3930586-11-23" Which is wrong. I'm trying to (a) get the correct date, which, per epoch converter is GMT: Mon, 29 Jun 2015 22:30:00 GMT. How do I get R to tell me the month,…
tomchi
  • 11
  • 2
0
votes
2 answers

Convert rownames of a matrix from character to POSIX

I don't know how to convert the rows of a matrix in R from character to POSIXt or another similar class. These are my character rows: [1] "2015.07.06 13.41.00.033" "2015.07.06 13.40.00.033" "2015.07.06 13.39.00.033" [4] "2015.07.06 13.38.00.033"…
Michele Della Mea
  • 966
  • 2
  • 16
  • 35
0
votes
1 answer

R help converting char to POSIXlt

I am having a lot of problems converting a char data.frame into a POSIXlt. This is my str output: 'data.frame': 5846 obs. of 5 variables: $ date : Factor w/ 184 levels "1/1/2015","1/10/2015",..: 31 31 31 31 31 31 31 31 31 31 ... $ time :…
0
votes
0 answers

Defining a ZOO time serie with POSIXlt and DST

I get an issue when trying to define a zoo object based on a POSIXlt vector containing a DST (Daylight Saving Time). Having a look at the source code of zoo() function, you can see that the warning arise from the behavior of match() that does not…
jlesuffleur
  • 1,113
  • 1
  • 7
  • 19
0
votes
0 answers

How to import a character - date field as POSIXlt class while importing the file itself in R?

I have a large file with more than 20 Million Rows. It has 5 date fields each of which is in a character format like this: "2012-12-31". After importing with a read.table, it gets imported as a 'character' field. I can convert it to POSIXlt with…
Selva
  • 2,045
  • 1
  • 23
  • 18
0
votes
1 answer

Summarizing Factors and Times with Stargazer

I am not sure why it seems so difficult to find information regarding summarizing non-quantitative variables with stargazer. I would like a summary of the following time variable (number of observations, min and max value would be…
Michael
  • 1,537
  • 6
  • 20
  • 42
0
votes
3 answers

How to extract a count of weekdays from a vector in R

I have a set of data from historical stock prices for publicly traded companies on the NASDAQ and NYSE. I've used the following code to download data on Amazon's stock price and get the times the data was sampled. library(quantmod) amzn <-…
user3682294
  • 29
  • 1
  • 6
-1
votes
2 answers

Can format like "May 17, 2017", "17/5/2017" or "17-5-17 05:24:39" be used in as.POSIXlt?

I've just read about the difference between POSIXlt and POSIXct and it is said that POSIXlt is a mixed text and character format like "May, 6 1985", "1990-9-1" or "1/20/2012". When I try such kind of things I get an error as.POSIXlt("May, 6 1985") #…
LulY
  • 976
  • 1
  • 9
  • 24
-1
votes
1 answer

Merge 2 date datasets

Reproductible code library("zoo") library("xts") x <- structure(c("2012-09-27 09:08:37", "2012-09-29 10:06:33", "2012-10-01 09:44:36","2012-10-04 14:37:05", "2012-10-15 13:18:21", "2012-10-17 17:33:46","2012-10-18 11:52:13", "2016-10-06 15:11:01",…
Badita Florin
  • 113
  • 1
  • 7
-1
votes
2 answers

Extract last time stamp of a day in R from 30 minute data

I have a dataset sampled irregularly at 30 min frequency as follows. I need to extract the index of last timestamp on each day. The dataset is as follows: datetime <-c("8/19/2011 16:00", "8/19/2011 17:30", "8/19/2011 18:30", "8/19/2011…
user1434997
  • 1,689
  • 2
  • 12
  • 12
-2
votes
2 answers

How to convert date & time to numeric by using POSIXct and how to calculate the time?

Hi Friends Both these columns(starttime/stoptime) are in Character class ,how could I convert to numeric(POSIXct) to find the time consumption ,Thank you starttime 12/31/2015 23:48 12/31/2015 23:47 12/31/2015 23:37 12/31/2015…
1 2 3
10
11