date-format

SimpleDateFormat: unparseable date exception

拟墨画扇 提交于 2019-12-19 17:46:17
问题 After looking after several existing posts, I am still not able to get my SimpleDateFormat parser working. Here is the code: SimpleDateFormat df = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US); try { volcanoListDate = df.parse(currentValue); } catch (ParseException e) { Log.d("DEBUG", e.toString()); Log.d("DEBUG", currentValue); } I always end up with a ParseException. Here is the output of the debug messages: 06-09 23:52:17.478: DEBUG/DEBUG(2436): java.text.ParseException:

Return null for date_format when input is null in mysql

╄→гoц情女王★ 提交于 2019-12-19 16:54:51
问题 I'm doing something like this: SELECT date_format(mydate, '%d/%m/%Y') FROM xyz; When mydate is NULL, date_format returns 00/00/0000. This is correct, but how can I make it so that it returns NULL when the input is NULL? 回答1: SELECT IF(mydate,date_format(mydate, '%d/%m/%Y'),NULL) FROM xyz; Source: http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html 回答2: You can wrap this into a IF -Clause, like this: SELECT IF(mydate,DATE_FORMAT(mydate, '%d/%m/%Y'),NULL) FROM xyz; That said, if

Java date format

安稳与你 提交于 2019-12-19 11:34:13
问题 Have String str "May 23 2011 12:20:00", want to convert it to date such this: Date date = (new SimpleDateFormat("MMM dd yyyy HH:mm:ss")).parse(str); It always gives me ParseException Unparsable date format: 'May 23 2011 12:20:00'. Looked for similar issues, seems everything right. What is wrong? 回答1: You may need to additionally specify the Locale , when the default Locale of your VM is not an English one: Date date = (new SimpleDateFormat("MMM dd yyyy HH:mm:ss", Locale.US)).parse(str); 回答2:

how to convert english date format to german date format in php

回眸只為那壹抹淺笑 提交于 2019-12-19 04:18:24
问题 Hi I have a date format like this (in English format) 15. July 2011 And I want to convert it in German format like this 15. Juli 2011 How to convert date format from one laguage to other language format? My Code is $date = '15. July 2011'; $newLocale = setlocale(LC_TIME, 'de_DE'); $date = strftime('%d. %B %Y',$date); But this is not converting I am getting July rather than Juli 回答1: You could use setlocale function before calling date function: $newLocale = setlocale(LC_TIME, 'de_DE', 'de_DE

How can I format an ISO 8601 date to a more readable format, using Javascript? [duplicate]

旧街凉风 提交于 2019-12-19 02:49:21
问题 This question already has answers here : Where can I find documentation on formatting a date in JavaScript? [closed] (35 answers) How to format a JavaScript date (54 answers) Closed 3 years ago . I'm using an API to call a date from a post. Dates are returned in ISO 8601 format : 2015-11-09T10:46:15.097Z I want my dates to be formatted like this : 09/11/2015 Then, later, I want to insert them into my HTML, like this : $(data).each(function(){ var html = '<randomhtml> '+this.created_at+'

How to convert date strings to timestamp without knowing the date format

拜拜、爱过 提交于 2019-12-18 14:53:38
问题 I am trying to write a query to insert a value into a timestamp with no timezone data type field. The value is coming from CSV file. The version I am working with is PostgreSQL 8.1.21 . The CSV file upload is done by the client and it has a date column. The date sometimes comes as '28-Sep-13' and sometimes as '28/09/2013' formats. I tried to use the following to cast the string into timestamp: str_date::timestamp . This works fine if str_date is something like '28-Sep-13' but it won't work if

WPF/C# - Applying date format to listview

你离开我真会死。 提交于 2019-12-18 12:58:08
问题 I have a listview bound to a collection of objects. One of the properties is a DateTime object named startDate. It's displayed in the standard 1/1/2001 1:00:00 PM format I want to put the date in yyyy-MM-dd HH:mm:ss.fff format just for display purposes. Is there a way to keep the underlying DateTime object in tact while displaying it in the desired format above? I'd prefer to do this in XAML as opposed to adding a display property to the object or something along those lines. The objects

How to change the language and date format in SQL Server?

谁说我不能喝 提交于 2019-12-18 11:33:25
问题 I am using SQL Server 2005. When I execute DBCC USEROPTIONS , I see the language as romana and dateformat as dmy . I want the language to be us_english and dateformat as mdy . How can I do this? I was having these settings initially but somehow they got changed to romana. How to revert back to us_english and date as dmy ? 回答1: You can reset the language by using the below syntax set language 'us_english' In order to view all the languages and their date format try this one select * from sys

how to insert current date into a DATE field in dd/mm/yyyy format in oracle

泄露秘密 提交于 2019-12-18 09:14:42
问题 I have a field in my table with datatype as DATE in Oracle. I want to insert the current date into that field, in format DD/MM/YYYY format. I tried the below query: select to_date(to_char(sysdate,'dd/mm/yyyy'),'dd/mm/yyyy') from dual But it gives 1/8/2011 12:00:00 AM. I want it to insert and show as 08/01/2011 12:00:00 AM. Can anyone help me in this please ? 回答1: DATE is a built-in type in Oracle, which is represented in a fixed way and you have no control over it. So: I want it to insert [..

Oracle - literal does not match format string error [duplicate]

那年仲夏 提交于 2019-12-18 05:55:06
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Simple Oracle query: literal does not match format string I am getting the following error: INSERT INTO CatalogueEntry VALUES('2001-12-10', 2, 14.99, 1, 0) ERROR at line 1: ORA-01861: literal does not match format string ` The first field is a DATE format. Any ideas? Thanks. 回答1: When you are inserting a string value to a date column, then you need to convert it to a date during the INSERT using the to_date()