date

Java ResultSet.getString() for Date field displaying 00:00:00.0

走远了吗. 提交于 2021-01-28 00:00:45
问题 I am using a generic method to loop through and convert a ResultSet to a String array. I am wondering why does the Date column in Oracle db value come print out as 2015-01-09 00:00:00.0 while the date in the database shows 2015-01-09 ? Here is the code, the col type in Oracle is Date while(rs.next()) { String[] arr = new String[colCount]; for(int i = 1; i <= colCount; i++) { arr[i-1] = rs.getString(i); }//end for list.add(arr); }//end while So that is part 1 of the question, part 2 of the

Recognizing invalid dates in postgresql

那年仲夏 提交于 2021-01-27 20:33:09
问题 I am trying to parse dirty input into postgres tables. I have a problem with a 'date' field occasionally containing non-dates such as '00000000' or '20100100'. pg refuses to accept these, and rightly so. Is there a way to have postgres recognize invalid dates (or only valid dates, if that works better), so I can substitute a sensible default? (I've considered building a table listing the dates I'm willing to accept, and use that in a sub-select, but that seems awfully inelegant.) Cheers,

DateTimes deserializing wrong: JsonConvert is returning wrong dates

扶醉桌前 提交于 2021-01-27 20:05:20
问题 I'm retrieving data from Solr in my code to get a list of Events. The results I get is formatted like so: public class SearchResults<T> where T : Result { public SearchResults() { Results = new List<T>(); } public IEnumerable<T> Results { get; set; } public int Total { get; set; } public IEnumerable<FacetField> FacetFields { get; set; } } so I get a list of results, a total count, and a list of facetfields. The list of results in this case is a list of EventResults: public class EventResult :

AmCharts v4 linechart, starts dateaxis 1 month late

橙三吉。 提交于 2021-01-27 20:04:58
问题 Using amcharts 4 i am displaying an xy chart (simple line graph). Each datapoint has the data set in chart.data, the first as and the following with 1 week intervals: { "Date": new Date(2015, 12, 31), "Value: 12345, "LineColor: "#000000" }, { "Date": new Date(2016, 01, 07), "Value: 234567, "LineColor: "#000000" } Despite this, the first dateAxis point displayed on the chart is (after formatting) Sun 31 Jan 2016 , which is not among the dates input. If i change the dateAxis.baseInterval to

java.text.ParseException: Unparseable date: java.text.DateFormat.parse(DateFormat.java:579)

∥☆過路亽.° 提交于 2021-01-27 19:11:45
问题 I have problem with SimpleDateFormat . SimpleDateFormat dtfmt=new SimpleDateFormat("dd MMM yyyy hh:mm a", Locale.getDefault()); Date dt=dtfmt.parse(deptdt); In Android Emulator works fine but in phone I have this error: W/System.err: java.text.ParseException: Unparseable date: "24 Oct 2016 7:31 pm" (at offset 3) W/System.err: at java.text.DateFormat.parse(DateFormat.java:579) Any solution? 回答1: Your deptdt contains Oct which looks like an English month name. But your Locale.getDefault()

Convert DDMMYYYY to YYYYMMDD date format in sql server?

喜夏-厌秋 提交于 2021-01-27 18:45:55
问题 I have a date in table as "26052016" in format DDMMYYYY I want to convert this date to "YYYYMMDD" format. Any idea I have tried this method select CONVERT(varchar(8),[doc-date],112) FROM C034_PDK_ParallelBillingSourceExtract But this is gives me the same date as a result. Please help me 回答1: I can find this way, i don't know if any other way exist or not.. declare @date nvarchar(max)='01052016' select convert(varchar(8),cast(CONCAT(SUBSTRING(@date,3,2),'/',SUBSTRING(@date,1,2),'/',SUBSTRING(

Convert date from string format to OLE automation date

别说谁变了你拦得住时间么 提交于 2021-01-27 18:15:29
问题 I have a date string 21-Apr-2018 . How do I convert this date string into OLE automation date in python? I am using Python v3.6. Definition of OLE date can be found here. https://msdn.microsoft.com/en-us/library/system.datetime.tooadate(v=vs.110).aspx An OLE Automation date is implemented as a floating-point number whose integral component is the number of days before or after midnight, 30 December 1899, and whose fractional component represents the time on that day divided by 24. For example

PHP: Time difference (min:sec:tenths)

霸气de小男生 提交于 2021-01-27 18:00:32
问题 How can I calculate time difference when operating with minutes:seconds.tenth ? For example how can I achieve this example: 40:24.5 - 67:52.4 = -27:27.9 I was going to use this but then discovered lack of tenths: $time1 = new date('40:24.5'); $time2 = new date('67:52.4'); $interval = $time1->diff($time2); echo $interval->format('%R%%i:%s:??'); 回答1: Like you already "tried", you can use DateTime extension: function time_difference($t1, $t2) { $t1 = DateTime::createFromFormat('i:s.u', $t1, new

String to Date with month all lowercase in java

ぃ、小莉子 提交于 2021-01-27 17:51:43
问题 I have a string that contains a date, in the following format: dd-mm-yyyy with the month that is all lowercased. For example: 25-aug-2019 Now i tried to use SimpleDateFormat to convert my string to a Date, but i have the following exception: java.text.ParseException: Unparseable date: "25-aug-2019" at java.text.DateFormat.parse(Unknown Source) at org.whoislibrary.servers.WhoisCom.parseResponse(WhoisCom.java:37) at org.whoislibrary.WhoisAbstract.executeQuery(WhoisAbstract.java:44) at org

Converting DateTime to Epoch milliseconds using Cypher in Neo4J

那年仲夏 提交于 2021-01-27 15:54:50
问题 I'm running a query using Cypher in Neo4J where I have to compare a createdAt property of a node against a given time unit in Epoch milliseconds. This createdAt property is a string in the DateTime format, which is defined as - DateTime date with a precision of miliseconds, encoded as a string with the following format: yyyy-mm-ddTHH:MM:ss.sss+0000, where yyyy is a four-digit integer representing the year, the year, mm is a two-digit integer representing the month and dd is a two-digit