草庐IT

date_parse

全部标签

java - date_trunc org.postgresql.util.PSQLException : ERROR: syntax error at or near "$1"

我在运行此Java/JDBC代码时遇到此错误。任何想法如何解决它?好像是在提示date_trunc函数中的参数?org.postgresql.util.PSQLException:错误:“$1”处或附近的语法错误排名:100atorg.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)atorg.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)atorg.

java - Thymeleaf:使用#dates.format() 函数来格式化具有国际化的日期。

我正在使用Thymeleaf#dates.format()函数在View层中格式化日期。我为pic日期格式创建了一个国际化属性文件。我正在使用#dates.format(date,(#{app.dateformat}))这样的函数。但是Thymeleaf抛出一个解析异常。因为thymeleaf现在解析app.dateformat。我如何在thymeleaf中使用日期格式国际化方式。以下是一个异常(exception):org.springframework.expression.spel.SpelParseException:EL1043E:(pos37):Unexpectedtoke

java - 当 str = 2011/12/12aaaaaaaaa 时,SimpleDateFormat parse(string str) 不会抛出异常?

这是一个例子:publicMyDate()throwsParseException{SimpleDateFormatsdf=newSimpleDateFormat("yyyy/MM/d");sdf.setLenient(false);Stringt1="2011/12/12aaa";System.out.println(sdf.parse(t1));}2011/12/12aaa不是有效的日期字符串。但是,该函数会打印“MonDec1200:00:00PST2011”并且不会抛出ParseException。谁能告诉我如何让SimpleDateFormat将“2011/12/12aaa”

java - 无法使用 @DateTimeFormat(模式 ="dd/MM/yyyy")转换 java.util.Date 中的字符串

我有一个带有日期字段的简单POJO。我想将对象与表单中的值绑定(bind)。在表单中,我使用的是日期格式为("dd/mm/yyyy")的jqueryuidatepicker我有console.log值,它是一个字符串:13-11-2014我正在使用spring4.0.7我依赖于joda-time2.5我得到这个异常:Failedtoconvertpropertyvalueoftype'java.lang.String'torequiredtype'java.util.Date'forproperty'endDate';nestedexceptionisorg.springframewo

java - 如何知道何时调用了 Parse.initialize()?

现在我正在使用静态boolean值来判断初始化何时发生。有没有更简单的方法知道我已经调用了初始化?谢谢!!!已解决!!!!非常感谢您的意见。您需要在扩展应用程序的类中初始化解析,然后将其作为应用程序(而不是其他Activity)添加到list文件中。:)这是我使用Parse的类(class):packagecom.example.myapp;importcom.parse.Parse;importandroid.app.Application;publicclassUseParseextendsApplication{@OverridepublicvoidonCreate(){supe

Java日历问题: why are these two Dates not equal?

importjava.io.*;publicclasstesting{publicstaticvoidmain(Stringa[])throwsException{Dated1=newDate();Thread.sleep(2000);Dated2=newDate();if(d1.equals(d2)){System.out.println("Bothequal");}else{System.out.println("Bothnotequal");}Calendarc1=Calendar.getInstance();Calendarc2=Calendar.getInstance();c

java - 字符串 -> java.util.Date -> java.sql.Date(带时间戳)

这是我的问题:我有一个用户输入一个日期,如:2012-12-24(字符串)我将时间连接到该字符串,然后转换为java.util.Date我的代码如下所示:Stringtempstartdate=startdte;//startdteisthestringvaluefromatxtfieldtempstartdate+="00:01:00";Stringtempenddate=startdte;tempenddate+="23:59:59";SimpleDateFormatdf=newSimpleDateFormat("yyyy-MM-ddhh:mm:ss");java.util.Dat

java - 如何解决 BeanDefinitionStoreException : IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet. xml]?

错误堆栈跟踪:SEVERE:StandardWrapper.Throwableorg.springframework.beans.factory.BeanDefinitionStoreException:IOExceptionparsingXMLdocumentfromServletContextresource[/WEB-INF/dispatcher-servlet.xml];nestedexceptionisjava.io.FileNotFoundException:CouldnotopenServletContextresource[/WEB-INF/dispatcher-ser

java - JPA 2.1 : Introducing Java 8 Date/Time API

我想在启用JPA的应用程序中添加对Java8日期/时间API(JSR-310)的支持。很明显JPA2.1doesnotsupporttheJava8Date/TimeAPI.作为解决方法,最常见的建议是使用AttributeConverter.在我现有的应用程序中,我将我的实体更改为对列映射字段使用LocalDate/LocalDateTime类型,并为java.util添加了旧版setter/getter.Date给他们。我创建了相应的AttributeConverter类。当使用Query.setParameter()和java.util.Date实例时,我的应用程序现在失败了(它

java - 如何将 util.Date 转换为 time.LocalDate 以正确处理 1893 年之前的日期

我google了一下,最常用的方法好像是date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();但是,对于1893-04-01之前的日期,此方法似乎会失败以下测试在我的机器上失败,结果为1893-03-31而不是1893-04-01:@TestpublicvoidtestBeforeApril1893()throwsParseException{Datedate=newSimpleDateFormat("yyyy-MM-dd").parse("1893-04-01");System.out.println(date);