date-formatting

Spring webflow and type conversion for date formatting

蹲街弑〆低调 提交于 2019-12-23 05:17:24
问题 Environment: Spring 3.1.3.RELEASE Spring webflow 2.3.0.RELEASE I have posted this question recently on spring source forum. See: Spring webflow formatting issue I followed the steps outlined in the reference documentation and the top answer in stackoverflow too: Answer I expect when my form submits and binding occurs, that a parse exception is thrown when entering in an invalid date value. But i do not see this happening. Also if and when the exception is thrown, how do i handle it to display

am/pm strings not localized/translated when using DateFormat

倖福魔咒の 提交于 2019-12-22 20:05:32
问题 When my app loads, I get device's settings in order to display dates/times according to user's locale. As seen on the image below, the pattern is correct, but the am/pm marker is not translated to the corresponding language (in this case language is Greek, local is "el_GR"). Is there a way to fix that? "am/pm" should be automatically translated to "πμ/μμ" public static final DateFormat USER_DF_TIME = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault()); 回答1:

How to get full name of month from date in Java 8 while formatting

≯℡__Kan透↙ 提交于 2019-12-22 07:04:32
问题 Using new Java 8 java.time API, I need to convert LocalDate and get full name of month and day. Like March (not Mar), and Monday (not Mon). Friday the 13th March should be formatted like Friday, 13 March.. not Fri, 13 Mar. 回答1: The string you are looking for is MMMM . Source: DateTimeFormatter Javadoc 回答2: tl;dr Use automatic localization. No need to specify formatting pattern. localDate.format( DateTimeFormatter.ofLocalizedDate( FormatStyle.FULL ) .withLocale( Locale.UK ) ) Monday, 23

Error: Attempted to call method “format” on null context object

浪子不回头ぞ 提交于 2019-12-22 05:47:08
问题 Spring-boot v1.4.1 Java v1.8 Thymeleaf v2.1.5. The following line of code in my view: <td th:each = "sprint : ${sprints}" th:text = "${sprint.releaseDate} ? ${#temporals.format(sprint.releaseDate, 'MMM/dd/yyyy')}"></td> which has syntax I am basing off of the S.O. question SpringBoot Thymeleaf Ordinal Numbers, produces the error: org.springframework.expression.spel.SpelEvaluationException: EL1011E:(pos 11): Method call: Attempted to call method format(java.time.LocalDate,java.lang.String) on

date format dd/MM/yyyy not working in asp.net mvc 5

混江龙づ霸主 提交于 2019-12-21 20:14:38
问题 I'm developing an asp.net mvc 5 application, in which I'm trying to set a validation for dd/MM/yyyy format, I've been struggling a lot to find an appropriate solution but no success, what I want it to accept: 24/01/2016 but it displays validation message as : The field JoiningDate must be a date. Here is what I've tried : [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] public DateTime JoiningDate { get; set; } Also, I want it to display the date in dd/MM

Convert datetime.datetime object to days since epoch in Python

六眼飞鱼酱① 提交于 2019-12-21 19:58:45
问题 I've got a pandas.Series object that might look like this: import pandas as pd myVar = pd.Series(["VLADIVOSTOK 690090", "MAHE", NaN, NaN, "VLADIVOSTOK 690090", "2000-07-01 00:00:00"]) myVar[5] is parsed as a datetime.datetime object when the data is read into Python via pandas . I'm assuming that converting this value to the number of days since epoch (36708) isn't difficult at all. I'm just new to Python and don't know how to do it. Thanks in advance! 回答1: myVar = pd.Series(["VLADIVOSTOK

In SQL Server, how to convert a date to a string in format M/D/YYYY? (no leading zeros, not MM/DD/YYYY)

白昼怎懂夜的黑 提交于 2019-12-21 07:55:42
问题 Right now, my code has the following conversion for a date field: convert(varchar, Citation.PublishedOn, 101) However, that returns dates like 03/01/2010. The request was to have the dates display as 3/1/2010 (without the leading zeros, but with a 4 digit year). I've looked at http://msdn.microsoft.com/en-us/library/ms187928.aspx and I'm not seeing anything that explicitly excludes leading zeros. How do I format the date to exclude leading zeros? 回答1: This is how I would do it: DECLARE @dt

Excel TEXT formula doesn't convert 'yyyy' to a year

旧时模样 提交于 2019-12-21 07:36:18
问题 I want to combine some text with a date in Excel 2013. Let's say I have a cell A2 with a date like 30-10-2014 . I tried to append the date after the text with this formula: ="Some text and a date: "&A2 But the output shows the date as a number: Some text and a date: 41942 So I tried it with the TEXT formula: ="Some text and a date: "&TEXT(A2;"dd-mm-yyyy") But this shows Some text and a date: 30-10-yyyy and not Some text and a date: 30-10-2014 So or I do not understand how the TEXT formula

ASP.NET MVC DataAnnotations doesn't accept dd-MM-yyyy format

六眼飞鱼酱① 提交于 2019-12-20 06:42:23
问题 In my ASP.NET MVC 4 project I have a DateOfBirth field that uses the DataAnnotations Validation Date Attribute... [Required(ErrorMessage = "This field is required"), Date] public DateTime DateOfBirth { get; set; } I have set the format of my DatePicker control to dd-MM-yyyy (default was yyyy-MM-dd). But when I submit the form I am told that the date format is not valid. dd-MM-yyyy is a valid date format so why would it complain? Is there any way to fix this? Thanks 回答1: try adding:

ASP.NET MVC DataAnnotations doesn't accept dd-MM-yyyy format

拟墨画扇 提交于 2019-12-20 06:42:18
问题 In my ASP.NET MVC 4 project I have a DateOfBirth field that uses the DataAnnotations Validation Date Attribute... [Required(ErrorMessage = "This field is required"), Date] public DateTime DateOfBirth { get; set; } I have set the format of my DatePicker control to dd-MM-yyyy (default was yyyy-MM-dd). But when I submit the form I am told that the date format is not valid. dd-MM-yyyy is a valid date format so why would it complain? Is there any way to fix this? Thanks 回答1: try adding: