format

What datetime format is this?

I have DateTime structure for an old data format that I don't have access to any specs for. There is a field which indicates the datetime of the the data, but it isn't in any format I recognize. It appears to be stored as a 32-bit integer, that increments by 20 for each day. Has anyone ever run across something like this? EDIT: Exam...

How to change timer format

Hi everyone, Ive created timer. How can I change the timer format to second so that it wont be long number? Thanks private long startTime = System.currentTimeMillis(); Timer timer = new Timer(1000, this); timer.start(); timer.stop(); long endTime = System.currentTimeMillis(); long timeInMilliseconds = (endTime - startTime); ...

invalid XML file?

Hello everyone, I wrote the following file in Visual Studio 2008 as a new XML file, and it reports the following error. What is the error message about and why it is treated as a wrong format XML file? Here is the XML file and related error message. <?xml version="1.0" encoding="utf-8"?> <Foo>&#x2;</Foo> Error 1 Character ' ', hexa...

Format a number as a string

How do you format a number as a string so that it takes a number of spaces in front of it? I want the shorter number 5 to have enough spaces in front of it so that the spaces plus the 5 have the same length as 52500. The procedure below works, but is there a built in way to do this? a = str(52500) b = str(5) lengthDiff = len(a) - len(...

How to nicely format floating types to String?

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 print these pseudo integers, but the problem is they are also mixed in with actual doubles. So how do I print these doubles nicely in Jav...

Excel merge and formatting

Simply put I am looking for a quick way to do the following. I would like to format an excel spreadsheet below: A B C D 1 foo bat abe test 2 foo bat cat test 3 foo bat dog test 4 bar moo hat girl 5 bar moo bat girl to look like this: A B C ...

Changing dateformat on a SQL Server DB and not on whole server to dd/mm/yyyy

Hi there, can anyone help, we have a sql server 2005 database installed (actually its an sql server 2000 attached to an sql server 2005 server) with the default server language language USA with dateformat like mm/dd/yy and we really need to keep it this way but currently just uploaded a new database to the server and this needs to have...

PHP "pretty print" HTML (not Tidy)

I'm using the DOM extension in PHP to build some HTML documents, and I want the output to be formatted nicely (with new lines and indentation) so that it's readable, however, from the many tests I've done: "formatOutput = true" doesn't work at all with saveHTML(), only saveXML() Even if I used saveXML(), it still only works on elements...

Why is String's format(Object... args) defined as a static method?

I wonder why Java 5 and above provide a printf-style formatter using a static method in class String like this: public static String format(String format, Object... args) instead of public String format(Object... args) so that we can write "%02d".format(5) to get 05 instead of String.format("%02d", 5). I imagined if I could modi...

AttributeError: 'str' object has no attribute 'format'

I am using Python 2.5.2 >>> for x in range(1,11): print '{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x) Traceback (most recent call last): File "", line 2, in print '{0:2d} {1:3d} {2:4d}'.format(x, x*x, x*x*x) AttributeError: 'str' object has no attribute 'format' I am not getting the problem When i did dir('hello') there was no...

string formatting

I am not getting why the colon shifted left in the second time >>> print '%5s' %':' : >>> print '%5s' %':' '%2s' %':' : : Help me out of this please ...

Locale date format in PHP5

Hi, my site changes its locale dependent upon either user settings or browser settings (where the user hasn't set their preference). I am using amline charts, the stock chart specifically, which requires the date format in 'MM/DD/YYYY' or 'DD-MM-YYYY', I guess so the chart knows how to understand the dates. There are many ways to format ...

How to programmatically format unallocated space?

Hello, I’m looking for a code snippet that would programmatically format unallocated space on a given drive. I’m ideally looking for .net code (VB.NET C#) or C++. Many thanks ...

date format using Ajaxpro

hello everyone i using AjaxPro to retreive database, the date field return Sat Apr 3 00:00:00 UTC+0700 1982 i want to format it like "dd/mm/yyyy" Please help! ...

PHP Currency Regular Expression

Hi All I am trying to find a piece of regex to match a currency value. I would like to match only numbers and 1 decimal point ie Allowed 10 100 100.00 Not Allowed Alpha Characters 100,00 +/- 100 I have search and tried quite a few without any luck. Hope you can advise ...

What is the best layer to use to format Currency numbers?

I use Javascript on frontend, C# as middle layer and Oracle 9i as DB. What is the best practice when formatting numbers with 2 decimal precision into a currency? And what layers should be preferred amongst any of these three layers? Keeping in mind that the User will be able to edit these amounts on a few of my screens on the applicati...

Format number as money

How do I format a number to look like this: 9,000 my database field is in money data type, when I pull it up I see it like this: 9000.0000 that don't look right to me (I would like it to look like a real money format) Sorry folks, forgot to mention technology it would be in C# Thanks! ...

string format with %g in C

How do I create a string so that it formats floating point numbers to have no trailing decimal point or digits when it is an integer, but to NOT switch to scientific notation for larger numbers? When I do: float myFloat= 15.6f; float myInt = 5.0f; float myLarge = 7000000.0f; sprintf(out, "my float is %g", myFloat); ...

How do I convert date formats in Perl without importing external modules?

Probably an easy answer: how do I convert this without importing external modules? I've read the CPAN but couldn't explicitly pinpoint a method that does the following: Convert: 20080428 to 28-APR-08 Any ideas? Even directing me to a tutorial would be appreciated. Regards, PIAS ...

Where's the DateTime 'Z' format specifier?

[Update: Format specifiers are not the same thing as format strings; a format specifier is a piece of a custom format string, where a format string is 'stock' and doesn't provide customization. My problem is with specifiers not formats] I've been trying to perform roundtrip DateTime conversions with a format string that uses 'zzz' forma...