date-format

highcharts tooltip wrong date

末鹿安然 提交于 2019-12-01 07:40:35
问题 I had made one highchart in that tooltip is shows date and time in format but it is showing wrong date and time. Please go through the code below. HTML Code <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> Javascript Code var maxval="94

how to create Date object from String value

南楼画角 提交于 2019-12-01 06:20:21
问题 When running through the below code I am getting an UNPARSABLE DATE EXCEPTION . How do I fix this? package dateWork; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateCreation { /** * @param args */ public static void main(String[] args) { String startDateString = "2013-03-26"; DateFormat df = new SimpleDateFormat("yyyy/MM/dd"); Date startDate=null; String newDateString = null; try { startDate = df.parse

SimpleDateFormat toPattern behaves differently in java 9

本秂侑毒 提交于 2019-12-01 04:39:04
问题 DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, new Locale("SV", "SE")); ((SimpleDateFormat) dateFormat).toPattern(); In Java 8 this line produces "yyyy-MM-dd" while in Java 9 it produces "y-MM-dd" . This has some serious issues for our legacy code, is there some way to revert the behaviour? 回答1: System.setProperty("java.locale.providers", "COMPAT,CLDR"); DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, new Locale("sv", "SE")); System.out.println((

How to format $.now() with Jquery

无人久伴 提交于 2019-12-01 03:14:04
$.now() gives me the time as miliseconds. I need to show it something like hh:mm:ss How can I do that in Jquery? function formatTimeOfDay(millisSinceEpoch) { var secondsSinceEpoch = (millisSinceEpoch / 1000) | 0; var secondsInDay = ((secondsSinceEpoch % 86400) + 86400) % 86400; var seconds = secondsInDay % 60; var minutes = ((secondsInDay / 60) | 0) % 60; var hours = (secondsInDay / 3600) | 0; return hours + (minutes < 10 ? ":0" : ":") + minutes + (seconds < 10 ? ":0" : ":") + seconds; } I'd suggest just using the Javascript Date object for this purpose. var d = new Date(); var time = d

Why Does Java's SimpleDateFormat parse this

*爱你&永不变心* 提交于 2019-12-01 03:07:19
Hi I've got a simple date format set up with a custom format string: MMddyy and I give it the following value to parse: 4 1 01 I don't think it should parse this because of the spaces but the Simple Date Format is returning the date April 4th 0001AD any ideas why? This is expected behaviour - you are telling the DateFormat object to expect a 6 character String representation of a date and that is what you passed in. Spaces are parsed OK. However, if you used "4x1x01" you would get an error. Note that when parsing, leniency defaults to true e.g. DateFormat df = new SimpleDateFormat("MMddyy");

Select all records between two datetime format

僤鯓⒐⒋嵵緔 提交于 2019-12-01 02:52:47
问题 I have this query, i need to select all records between two dates, the mysql table is a datetime format. I tried this but it didn't work. select * from cdr WHERE calldate BETWEEN '2012-12-01' AND '2012-12-03'; 回答1: Try this instead: select * from cdr WHERE DATE(calldate) BETWEEN '20121201' AND '20121203'; 回答2: Try this query - SELECT * FROM cdr WHERE calldate BETWEEN str_to_date('2012-12-01','%Y-%m-%d') AND str_to_date('2012-12-03','%Y-%m-%d'); 回答3: The above will work great. If you wanted to

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

谁说我不能喝 提交于 2019-11-30 23:22:49
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 matino You could use setlocale function before calling date function: $newLocale = setlocale(LC_TIME, 'de_DE', 'de_DE.UTF-8'); EDIT: Quote from strftime docs: This example will work if you have the respective locales

Date separator issue

天大地大妈咪最大 提交于 2019-11-30 23:22:35
问题 I have the following code DateTime.Now.ToString("MM/dd/yyyy") It always gives me this output : "04.13.2011" instead of "04/13/2011". May I know why I am getting this weird issue? 回答1: You're almost certainly in a culture where that's the default date separator. If you want to force / you can quote it in the format string: string x = DateTime.Now.ToString("MM'/'dd'/'yyyy") 回答2: Try this DateTime.Now.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture) 回答3: Use following code: DateTime.Now

How to format $.now() with Jquery

我只是一个虾纸丫 提交于 2019-11-30 22:35:42
问题 $.now() gives me the time as miliseconds. I need to show it something like hh:mm:ss How can I do that in Jquery? 回答1: function formatTimeOfDay(millisSinceEpoch) { var secondsSinceEpoch = (millisSinceEpoch / 1000) | 0; var secondsInDay = ((secondsSinceEpoch % 86400) + 86400) % 86400; var seconds = secondsInDay % 60; var minutes = ((secondsInDay / 60) | 0) % 60; var hours = (secondsInDay / 3600) | 0; return hours + (minutes < 10 ? ":0" : ":") + minutes + (seconds < 10 ? ":0" : ":") + seconds; }

NSDateFormatter- stringFromDate not returning AM/PM

依然范特西╮ 提交于 2019-11-30 14:57:09
问题 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"hh:mm:ss a"]; NSLog(@"Today's Time: %@", [formatter stringFromDate:[NSDate date]]); The above code just gives the following output Today's Time: 15:46:43 I want the output to be Today's Time: 3:46 PM . I surfed a lot and i did not find a way to show AM/PM. Would be really helpful if someone can help me find a way out. I am using XCode 6.3 and my Device has iOS 8.3 installed in it. 回答1: Check your device