Questions tagged [format]

It may refer to text formatting, content format, file format, document file format, etc.

Filter by
Sorted by
Tagged with
3421votes
59answers
1.5mviews

How can I pretty-print JSON in a shell script?

Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... ...
2053votes
25answers
720kviews

How can I print literal curly-brace characters in a string and also use .format on it?

x = " \{ Hello \} {0} " print(x.format(42)) gives me : Key Error: Hello\\ I want to print the output: {Hello} 42
user avatar
  • 21.7k
953votes
22answers
838kviews

.NET String.Format() to add commas in thousands place for a number

I want to add a comma in the thousands place for a number. Would String.Format() be the correct path to take? What format would I use?
user avatar
  • 65.8k
756votes
18answers
1.3mviews

How do I display a decimal value to 2 decimal places?

When displaying the value of a decimal currently with .ToString(), it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 ...
user avatar
  • 10k
697votes
11answers
649kviews

Formatting a number with leading zeros in PHP [duplicate]

I have a variable which contains the value 1234567. I would like it to contain exactly 8 digits, i.e. 01234567. Is there a PHP function for that?
user avatar
  • 12k
571votes
28answers
753kviews

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

A 64-bit double can represent integer +/- 253 exactly. Given this fact, I choose to use a double type as a single type for all my types, since my largest integer is an unsigned 32-bit number. But now ...
user avatar
  • 26.8k
571votes
10answers
658kviews

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

I have the following date: 2011-08-12T20:17:46.384Z. What format is this? I'm trying to parse it with Java 1.4 via DateFormat.getDateInstance().parse(dateStr) and I'm getting java.text....
user avatar
442votes
13answers
665kviews

How to auto-format code in Eclipse?

How do you auto-format code in Eclipse?
user avatar
441votes
30answers
534kviews

Android TextView Justify Text

How do you get the text of a TextView to be Justified (with text flush on the left- and right- hand sides)? I found a possible solution here, but it does not work (even if you change vertical-center ...
user avatar
415votes
27answers
626kviews

How do you display JavaScript datetime in 12 hour AM/PM format?

How do you display a JavaScript datetime object in the 12 hour format (AM/PM)?
user avatar
  • 16.4k
393votes
5answers
215kviews

What's the difference between ISO 8601 and RFC 3339 Date Formats?

ISO 8601 and RFC 3339 seem to be two formats that are common the web. Should I use one over the other? Is one just an extension? Do I really need to care that bad?
user avatar
382votes
33answers
420kviews

Format timedelta to string

I'm having trouble formatting a datetime.timedelta object. Here's what I'm trying to do: I have a list of objects and one of the members of the class of the object is a timedelta object that shows ...
user avatar
  • 3,869
364votes
17answers
608kviews

Convert one date format into another in PHP

Is there a simple way to convert one date format into another date format in PHP? I have this: $old_date = date('y-m-d-h-i-s'); // works $middle = strtotime($old_date); // ...
user avatar
  • 29.2k
357votes
25answers
658kviews

How to format date and time in Android?

How to format correctly according to the device configuration date and time when having a year, month, day, hour and minute?
user avatar
  • 265k
330votes
4answers
254kviews

How to format code in Xcode? [duplicate]

I wonder how can I format my code to align it neatly? Does it have a feature similar to Eclipse's ctrlshiftf?
user avatar

15 30 50 per page
1
2 3 4 5
805