What is the opposite of GROUP_CONCAT in MySQL?

You could use a query like this: SELECT id, SUBSTRING_INDEX(SUBSTRING_INDEX(colors, ‘,’, n.digit+1), ‘,’, -1) color FROM colors INNER JOIN (SELECT 0 digit UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) n ON LENGTH(REPLACE(colors, ‘,’ , ”)) <= LENGTH(colors)-n.digit ORDER BY id, n.digit Please see fiddle here. Please notice that this query … Read more

What is this date format? 2011-08-12T20:17:46.384Z

The T is just a literal to separate the date from the time, and the Z means “zero hour offset” also known as “Zulu time” (UTC). If your strings always have a “Z” you can use: SimpleDateFormat format = new SimpleDateFormat( “yyyy-MM-dd’T’HH:mm:ss.SSS’Z'”, Locale.US); format.setTimeZone(TimeZone.getTimeZone(“UTC”)); Or using Joda Time, you can use ISODateTimeFormat.dateTime().

How to format date and time in Android?

Use the standard Java DateFormat class. For example to display the current date and time do the following: Date date = new Date(location.getTime()); DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); mTimeText.setText(“Time: ” + dateFormat.format(date)); You can initialise a Date object with your own values, however you should be aware that the constructors have been deprecated and you should … Read more

How to nicely format floating numbers to string without unnecessary decimal 0’s

If the idea is to print integers stored as doubles as if they are integers, and otherwise print the doubles with the minimum necessary precision: public static String fmt(double d) { if(d == (long) d) return String.format(“%d”,(long)d); else return String.format(“%s”,d); } Produces: 232 0.18 1237875192 4.58 0 1.2345 And does not rely on string manipulation.