date-parsing

Parsing date by multiple formats with pivotYear set up for 2 digit years

 ̄綄美尐妖づ 提交于 2019-12-11 02:16:39
问题 I am having trouble to implement "simple" parsing of a date. The requirement is to allow enter year in two or four digits. When two digits are entered then make the split date for deciding into what century it belongs the first of January next year. Here is what I have so far: DateTime now = new DateTime(); int pivotYear = now.getYear() - 49; // 2013 - 49 = 1964 where 49 is the DateTimeParser[] parsers = { DateTimeFormat.forPattern("dd/MM/yy").withPivotYear(pivotYear).withLocale(new Locale(

Why don't I get the year right using SimpleDateFormat in java?

丶灬走出姿态 提交于 2019-12-11 01:07:00
问题 I trying to parse a data in a MySql Format, I ran across SimpleDateFormat . I can get the proper day and month, but I got a strange result for the year : date = 2009-06-22; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date d = sdf.parse(date); System.println(date); System.println(d.getDate()); System.println(d.getMonth()); System.println(d.getYear()); Outputs : 2009-06-22 22 OK 5 Hum... Ok, months go from 0 to 11 109 o_O WTF ? I tried changing the format to YYYY-MM-dd (got an

Ruby parse date string [closed]

烂漫一生 提交于 2019-12-09 07:48:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I need to parse a date string mentioned below to std date format. Is there a built in function in ruby that would parse something like, December 09, 2011 to 2011-12-09 回答1: Date.parse is already mentioned. I prefer Date.strptime . This methods is a reverse strftime . Date.parse is a (maybe good) guess, with Date

ZonedDateTimeDeserializer is missing in jackson jsr310

佐手、 提交于 2019-12-07 05:13:21
问题 I'm parsing a ZonedDateTime using like this: @JsonSerialize(using = ZonedDateTimeSerializer.class) private ZonedDateTime expirationDateTime; I need to be able to properly deserialize this date. However, there is no deserializer for this that is provided by jackson: com.fasterxml.jackson.datatype.jsr310.deser Is there a reason why it's missing? What is the most common workaround? Updated : Here is my scenario: I create ZonedDateTime like this: ZonedDateTime.of(2017, 1, 1, 1, 1, 1, 1,

mustache.js date formatting

送分小仙女□ 提交于 2019-12-05 22:02:26
问题 I have started using mustache.js and so far I am very impressed. Although two things puzzle me. The first leads on to the second so bear with me. My JSON {"goalsCollection": [ { "Id": "d5dce10e-513c-449d-8e34-8fe771fa464a", "Description": "Multum", "TargetAmount": 2935.9, "TargetDate": "/Date(1558998000000)/" }, { "Id": "eac65501-21f5-f831-fb07-dcfead50d1d9", "Description": "quad nomen", "TargetAmount": 6976.12, "TargetDate": "/Date(1606953600000)/" } ]}; My handling function function

JDK8: unable to parse LocalTime

最后都变了- 提交于 2019-12-05 10:40:28
问题 I managed to parse a String to a LocalDate object: DateTimeFormatter f1=DateTimeFormatter.ofPattern("dd MM yyyy"); LocalDate d=LocalDate.parse("26 08 1984",f1); System.out.println(d); //prints "1984-08-26" But I cannot do the same with LocalTime . This piece of code: DateTimeFormatter f2=DateTimeFormatter.ofPattern("hh mm"); LocalTime t=LocalTime.parse("11 08",f2); //exception here System.out.println(t); Throws a DateTimeParseException : Exception in thread "main" java.time.format

ZonedDateTimeDeserializer is missing in jackson jsr310

ε祈祈猫儿з 提交于 2019-12-05 09:09:41
I'm parsing a ZonedDateTime using like this: @JsonSerialize(using = ZonedDateTimeSerializer.class) private ZonedDateTime expirationDateTime; I need to be able to properly deserialize this date. However, there is no deserializer for this that is provided by jackson: com.fasterxml.jackson.datatype.jsr310.deser Is there a reason why it's missing? What is the most common workaround? Updated : Here is my scenario: I create ZonedDateTime like this: ZonedDateTime.of(2017, 1, 1, 1, 1, 1, 1, ZoneOffset.UTC) Then I serialize the object that contains the date like this: public static String toJSON(Object

d3.js parsing date error with csv file

余生颓废 提交于 2019-12-05 04:50:41
问题 I have a problem with parsing dates in a csv file. Have been looking for hours online and in books and testing, without finding the solution. Perhaps someone can help. The code works fine for reading a file with parsing just numbers. But when parsing a file with dates I get the following error message indicating the date format is not recognised: Problem parsing d="MNaN,268.5466377440347LNaN,117.78741865509761LNaN ... The file looks like this: date,value 11-11-13,582 12-11-13,860 13-11-13,940

Parse Different Date formats: Regex

ぐ巨炮叔叔 提交于 2019-12-04 05:29:15
问题 reposting this questions with specifics (because the last one was flagged down). I am working on parsing messy (tessearct-ocr) from archives cards to get atleast 50% of the info (date1). The data rows contain dates in different forms as per data sample below. Raw_Text 1 "15957-8 . 3n v g - vw, 1 ekresta . bowker, william e tley n0 .qu v- l. c. s. peteris, forestville, n. y. .mafae date1 june 17,1942 by davis, c. j6 l. g. b. jonnis, buffalo, n. y. ngsted decl 17, 1949.3y 7 davis, c. j. date3

mustache.js date formatting

。_饼干妹妹 提交于 2019-12-04 03:43:14
I have started using mustache.js and so far I am very impressed. Although two things puzzle me. The first leads on to the second so bear with me. My JSON {"goalsCollection": [ { "Id": "d5dce10e-513c-449d-8e34-8fe771fa464a", "Description": "Multum", "TargetAmount": 2935.9, "TargetDate": "/Date(1558998000000)/" }, { "Id": "eac65501-21f5-f831-fb07-dcfead50d1d9", "Description": "quad nomen", "TargetAmount": 6976.12, "TargetDate": "/Date(1606953600000)/" } ]}; My handling function function renderInvestmentGoals(collection) { var tpl = '{{#goalsCollection}}<tr><td>{{Description}}</td><td>{