similar to: how to convert character string with only month and year into date

Displaying 20 results from an estimated 10000 matches similar to: "how to convert character string with only month and year into date"

2009 Mar 31
4
Convert Character to Date
Hello, I have a date in the format Year-Month Name (e.g. 1990-January) and R classes it as a character. I want to convert this character into a date format, but when I try as.Date(1990-January, "%Y-%B"), I get back NA. The function strptime also gives me NA back. Thanks. [[alternative HTML version deleted]]
2010 Nov 08
2
finding the last day of the month
Dear R Help, I am trying to get fields showing the last day of each month for a monthly closing project. In order to find the last day of the previous month, I subtract the number of days from the current month. For all months my code works; however, for October, my code doesn't work...it returns 2010-09-*29* instead of 2010-09-*30*. format(strptime("2010-10-31",
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 > |
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: >
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
2012 Jul 23
2
date conversation
Hello, when I convert a factor like this a=01.10.2009 into a date using b=strptime(a, format="%d. %m. %Y"). It works very well. But when I try to convert c = 2009/10 into a date using d=strptime(c, format="%Y/%m") it doesnt work at all. I get d=NA. What did I do wrong? Thank you very much for your help! best regards Claudia
2006 Mar 14
2
Date problem
Hello, I have some "stupid" problems managing "date" data. I have a colomn "date", which I converted from a character representation: for example: a="26/02/06" date=strptime(a,format="%d/%m/%y") For one part of the analysis, I'm interested only in the month and the year, so I did: m.y=strftime(date,format="%m/%y") This returns me
2013 Mar 19
1
Convert to date and time of the year
Dear R Users, I have data for more than 3 years. For each year I want to find the day corresponding to Jaunary 1 of that year. For example: > x <- c('5/5/2007','12/31/2007','1/2/2008') > #Convert to day of year (julian date) - > strptime(x,"%m/%d/%Y")$yday+1 [1] 125 365 2 I want to know how to do the same thing but with time added. But I still
2010 Jul 07
3
Need help in handling date
Dear all, I have a date related question. Suppose I have a character string "March-2009", how I can convert it to a valid date object like as.yearmon("2009-01-03") in the zoo package? Is there any possibility there? Ans secondly is there any R function which will give the names of of all months as "LETTERS" does? Thanks for your time. [[alternative HTML version
2012 Mar 27
1
Convert day of year back into a date format.
Hello, I am having trouble figuring out how to convert a Day of Year integer back into a Date format. For example I have the following: date <- c('2008-01-01','2008-01-02','2008-01-03','2008-01-04','2008-01-05','2008-01-06','2008-01-07',
2003 Dec 15
2
Week of the Year date conversion
Hello there fellow R-users, I have received some data which comes in the following format: example1<-"200301" The first 4 digits correspond to the year and the remaining 2 digits correspond to the week of the year. I have tried to convert this to a date by using strptime as follows: strptime(example1,format="%Y%U") where U (looking up strptime) is the week of the
2007 Oct 09
2
extract year or month from date
Hi, I am having trouble extracting just the year or the month or the day from a date such as 5/7/2007 which is May 7th 2007. Is there any particular function to extract just the year from this format? When I am reading this data from a text file it is reading it correctly in the same format but does not acknowlede it as date but as a factor. If I try as.date(5/7/2007) then it is converting it to
2010 Aug 13
3
transforming dates into years
Hello! If I have in my data frame MyFrame a variable saved as a Date and want to translate it into years, I currently do it like this using "zoo": library(zoo) as.year <- function(x) as.numeric(floor(as.yearmon(x))) myFrame$year<-as.year(myFrame$date) Is there a function that would do it directly - like "as.yearmon" - but for years? Thank you! -- Dimitri
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello! I have a data frame with dates. I need to create a new "month" that starts on the 20th of each month - because I'll need to aggregate my data later by that "shifted" month. I wrote the code below and it works. However, I was wondering if there is some ready-made function in some package - that makes it easier/more elegant? Thanks a lot! # Example data:
2005 Dec 19
3
given a mid-month date, get the month-end date
I have a vector of dates. I wish to find the month end date for each. Any suggestions? e.g. For 12/15/05, I want 12/31/05, For 10/15/1995, I want 10/31/1995, etc __________________________________________________ [[alternative HTML version deleted]]
2018 Mar 06
0
raster time series statistics
Hi Herry, This is probably due to a call to strptime (or similar). No, it doesn't accept %Y-%m as a valid format. Maybe add a constant day to all the dates as that will work: dt<-list(ID=seq(1:24),month=rep(formatC(1:12,flag=0,width=2),2), year=sort(rep(2016:2017,12))) timelst<-paste(unlist(dt['year']),unlist(dt['month']),"01",sep="-")
2004 Jan 09
2
strange behaviour when converting from char to POSIX (PR#6422)
Full_Name: Christoph Schmutz, MeteoSchweiz, Switzerland Version: R1.7.1, R1.8.1 OS: windows2000, solaris sunOS 5.8 Submission from: (NULL) (141.249.133.6) I'm not sure if I don't get the clue, but please consider this: > strptime("19930870150","%Y%j%H%M") [1] "1993-03-28 01:50:00" > strptime("19930870250","%Y%j%H%M") [1]
2010 Oct 25
3
finding the year of a date
I know that I can use as.yearmon in the package "zoo" to find the year and the month of a date. I can use as. yearqtr to find the year and the quarter. But how can one find just the year of a date? Thanks a lot! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com
2010 Oct 13
1
strip month and year from MM/DD/YYYY format
Greetings I'm having difficulty witht the strptime function. I can't seem to figure a way to strip month (name) and year and create separate columns from a column with MM/DD/YYYY formatted dates. Can anyone help? Cheers Kurt *************************************************************** Kurt Lewis Helf, Ph.D. Ecologist EEO Counselor National Park Service Cumberland Piedmont Network
2010 Mar 18
1
probable timezone confusion with as.yearmon
It looks like a timezone issue, and it's causing confusion to me at least. My original data: gmt <- c("19880101 0000", "19880101 0100", "19880101 0300", "19880101 0400", "19880101 0500", "19880101 0600") These were converted to local dates/times with akst<-strptime(gmt,format="%Y%m%d %H%M")-(3600*9) # because I want