All Questions

246
votes
13answers
337713 views

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); // re...
385
votes
21answers
475709 views

How to nicely format floating numbers to String without unnecessary decimal 0?

An 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 unsigned 32-bit. But now I have to...
439
votes
10answers
351349 views

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?
829
votes
11answers
181958 views

How can I print literal curly-brace characters in python 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
110
votes
4answers
143218 views

Correct format specifier to print pointer (address)?

Which format specifier should I be using to print the address of a variable? I am confused between the below lot. %u - unsigned integer %x - hexadecimal value %p - void pointer Which w...
217
votes
21answers
404318 views

How do you format date and time in Android?

How do you format correctly according to the device configuration a date and time when having year, month, day, hour and minute?
310
votes
22answers
350975 views

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...
167
votes
17answers
236243 views

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)?
70
votes
17answers
345322 views

Format numbers in JavaScript similar to C#

Is there a simple way to format numbers in JavaScript, similar to the formatting methods available in C# (or VB.NET) via ToString("format_provider") or String.Format()?
169
votes
19answers
162790 views

Python format timedelta to string

I'm a Python newbie (2 weeks) and 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 objec...

Previous Next