Questions tagged [format]

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

Format may refer to:

* Text formatting, typesetting of text elements

Computing:

* File format, particular way that information is encoded for storage in a computer file
* Content format, encoded format for converting a specific type of data to displayable information
* Document file format, for storing documents on a storage media, especially for use by computers
* Audio format, medium for storing sound and music
* Audio file format, for storing digital audio data on a computer system
* Format (command), a command-line utility in many computer operating systems
* Format (computing), a computer command to prepare hard disks
* Format (Common Lisp), a programming function

Source: Wikipedia

12907 questions
3609
votes
62 answers

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" } ... into something like this: { "foo": "lorem", "bar": "ipsum" }
AnC
2427
votes
23 answers

How do I escape curly-brace ({}) characters in a string while using .format (or an f-string)?

Non-working example: print(" \{ Hello \} {0} ".format(42)) Desired output: {Hello} 42
Schitti
  • 25,489
  • 8
  • 24
  • 21
1028
votes
23 answers

.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?
Seibar
  • 68,705
  • 38
  • 88
  • 99
815
votes
19 answers

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 decimal places. Do I use a variation of .ToString()…
wows
  • 10,687
  • 7
  • 27
  • 27
732
votes
11 answers

Formatting a number with leading zeros in PHP

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?
Andromeda
  • 12,659
  • 20
  • 77
  • 103
656
votes
12 answers

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.ParseException: Unparseable date:…
Sarah Vessels
  • 30,930
  • 33
  • 155
  • 222
610
votes
29 answers

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 I have to print these pseudo integers, but the…
Pyrolistical
  • 27,624
  • 21
  • 81
  • 106
483
votes
33 answers

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)?
bbrame
  • 18,031
  • 10
  • 35
  • 52
466
votes
22 answers

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 to center_vertical, etc).
user130076
453
votes
5 answers

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?
Brig Lamoreaux
449
votes
13 answers

How to auto-format code in Eclipse?

How do you auto-format code in Eclipse?
HasanAboShally
  • 18,459
  • 7
  • 30
  • 34
431
votes
34 answers

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 the duration of an event. I would like to…
mawcs
  • 4,357
  • 2
  • 18
  • 7
380
votes
18 answers

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); // returns bool(false) $new_date = date('Y-m-d H:i:s',…
Tom
  • 30,090
  • 27
  • 90
  • 124
376
votes
4 answers

How to format code in Xcode?

I wonder how can I format my code to align it neatly? Does it have a feature similar to Eclipse's ctrlshiftf?
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
376
votes
26 answers

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?
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
1
2 3
99 100