I need to make an id with a specific  format  where 2 first digit are year, and the rest are just incremental number with 000 as spacer between year and incremental number where the qty of 0 will decrease along with increasingly incremental number such as 190001,190002,.....,190180,...,191400.  All i can think of using   $id = ''; if(srtrlen($number) == 1){    $id = date('y',time()).'000'.$number; } elseif(strlen($number)==2){    $id = date('y',time()).'00'.$number; } . . . else{    $id = date('y',time()).$number; }
10332
I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly and cumbersome. I'm sure there must be some concise way. Any Suggestions
71224
I have this function...  private string dateConvert(string datDate) {         System.Globalization.CultureInfo cultEnGb = new System.Globalization.CultureInfo("en-GB");         System.Globalization.CultureInfo cultEnUs = new System.Globalization.CultureInfo("en-US");          DateTime dtGb = Convert.ToDateTime(datDate, cultEnGb.DateTimeFormat);         datDate = dtGb.ToString(cultEnUs.DateTimeFormat.ShortDatePattern);          return datDate; }   But I want it with the leading zero still on lower digits (1-9) so the date is 11-09-2009 (mm-dd-yyyy)...  Now If I wasn't converting it id use string.Format("{0:d}", dateVar) how do I do this in the conversion?  ***** Solution ***** Used a slightly modified version of the answer below (i.e. one that would render).  Convert.ToDateTime(datDate).ToString("MM-dd-yyyy");
5691
Is there a better way of getting this result? This function fails if num has more digits than digits, and I feel like it should be in the library somewhere (like Integer.toString(x,"%3d") or something)  static String intToString(int num, int digits) {     StringBuffer s = new StringBuffer(digits);     int zeroes = digits - (int) (Math.log(num) / Math.log(10)) - 1;      for (int i = 0; i &lt; zeroes; i++) {         s.append(0);     }     return s.append(num).toString(); }
30416
this code always returns 0 in PHP 5.2.5 for microseconds:  &lt;?php $dt = new DateTime(); echo $dt-&gt;format("Y-m-d\TH:i:s.u") . "\n"; ?&gt;   Output:  [root@www1 ~]$ php date_test.php 2008-10-03T20:31:26.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:27.000000 [root@www1 ~]$ php date_test.php 2008-10-03T20:31:28.000000   Any ideas?
28516
How do I format a number in Java? What are the &quot;Best Practices&quot;? Will I need to round a number before I format it?  32.302342342342343 =&gt; 32.30 .7323 =&gt; 0.73  etc.
6769
In PHP, is there an easy way to convert a number to a word? For instance, 27 to twenty-seven.
73819
I'm trying to find the last two digits of ${2012}^{2012}$. I know you can use (mod 100) to find them, but I'm not quite sure how to apply this. Can someone please explain it?
123044
I would like to highlight specific digits in a number. Since the number is large I would like to use \num{} from . Of course I can do it manually as in the MWE below, but was hoping that there might be an easy way to use the commented out syntax to accomplish this:  Code: \documentclass{article} \usepackage{xcolor} \usepackage{siunitx}  \newcommand*{\Color}[2][red]{\textcolor{#1}{#2}}%  \begin{document}  \num{99 976}  88\,9\Color{76} %\num{88 9\Color{76}}  77\,\Color{976} %\num{77 \Color{976}}  \end{document}
26280
What is an easy way in Python to format integers into strings representing thousands with K, and millions with M, and leaving just couple digits after comma?  I'd like to show 7436313 as 7.44M, and 2345 as 2,34K.  Is there some % string formatting operator available for that? Or that could be done only by actually dividing by 1000 in a loop and constructing result string step by step?
105976
I'm trying to create a calculated column that uses the list item's ID field as part of the calculated string value. When I create a new list item, the calculated field seems to always use 0 as the ID value. I know that during creation, the new list items ID is 0 until the content database is updated, which apparently generates the actual ID. Is there a way to get the calculated column to accurately reflect the ID value of the list item?
119854
I have a table that represents a timetable for bus, so each cell contains time of departure as hour followed by minute, both as two digits, but sometimes I don't have two digits,just one so I have to switch eg. from 12 4 -&gt; 12 04. How is it possible?
67323
Why is a signed integer used to represent timestamps? There is a clearly defined start at 1970 that's represented as 0, so why would we need numbers before that? Are negative timestamps used anywhere?
15587
I have a query to insert a row into a table, which has a field called ID, which is populated using an AUTO_INCREMENT on the column. I need to get this value for the next bit of functionality, but when I run the following, it always returns 0 even though the actual value is not 0:  MySqlCommand comm = connect.CreateCommand(); comm.CommandText = insertInvoice; comm.CommandText += "\'" + invoiceDate.ToString("yyyy:MM:dd hh:mm:ss") + "\', " + bookFee + ", " + adminFee + ", " + totalFee + ", " + customerID +  ")"; int id = Convert.ToInt32(comm.ExecuteScalar());   According to my understanding, this should return the ID column, but it just returns 0 every time. Any ideas?  EDIT:  When I run:  "INSERT INTO INVOICE (INVOICE_DATE, BOOK_FEE, ADMIN_FEE, TOTAL_FEE, CUSTOMER_ID) VALUES ('2009:01:01 10:21:12', 50, 7, 57, 2134);last_insert_id();"   I get:  {"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'last_insert_id()' at line 1"}
28318
I'm trying to format numbers. Examples:  1     =&gt; 1 12    =&gt; 12 123   =&gt; 123 1234  =&gt; 1,234 12345 =&gt; 12,345   It strikes as a fairly common thing to do but I can't figure out which filter I'm supposed to use.  Edit: If you've a generic Python way to do this, I'm happy adding a formatted field in my model.
2568
I saw a potential answer here but that was for YYYY-MM-DD:   I modified the code code above for MM-DD-YYYY like so but I still can't get it to work:  String.prototype.isValidDate = function()  {      var IsoDateRe = new RegExp("^([0-9]{2})-([0-9]{2})-([0-9]{4})$");      var matches = IsoDateRe.exec(this);      if (!matches) return false;      var composedDate = new Date(matches[3], (matches[1] - 1), matches[2]);      return ((composedDate.getMonth() == (matches[1] - 1)) &amp;&amp;       (composedDate.getDate() == matches[2]) &amp;&amp;       (composedDate.getFullYear() == matches[3])); }   How can I get the above code to work for MM-DD-YYYY and better yet MM/DD/YYYY?  Thanks.
92690
I know that if you create a custom object, with an Auto-number Name field with a format, e.g. MYC-{0000} you will be able to create records from MYC-0000 to MYC-9999.  The moment you create 10,000 records Salesforce happily extends the range and you can then create MYC-10000 to MYC-99999.  My question is, what is the limit to this - for obvious reasons its a difficult one to test. I know instances that have exceeded 999,999 e.g. MYC-1000000 but am interested to know how far this extends to.  EDIT: When the field has a data type of Text the maximum length is 80. Is it safe to assume that the same is true for Autonumber (though that would be a very big number)?
51700
MySQL column > sdate, edate ( its 2 column).  sdate is start date for project starting and edate is end date for project ending.  so i need to make search between them..  &lt;strong&gt;Search&lt;/strong&gt;&lt;br /&gt; &lt;form method="post" action="search.php"&gt;   Start Report Date : &lt;input type="text" name="sdate" /&gt;   End Report Date : &lt;input type="text" name="edate" /&gt;   &lt;input type="submit" name="Submit" value="Search" /&gt; &lt;/form&gt;  This is example data in mysql sdate             Project Name      edate 22 December 2008  project 1         23 December 2008 25 December 2008  project 2         26 December 2008 24 December 2008  project 3         27 December 2008 1  January 2008   project 4         20 January 2008 10 December 2008  project 5         12 December 2008   so let say a user entered sdate ( eg, 22 December 2008 ) and edate ( eg, 30 December 2008 ).  It should display  22 December 2008  project 1         23 December 2008 25 December 2008  project 2         26 December 2008 24 December 2008  project 3         27 December 2008   So i need a php code sql query which should display entries lies between those 2 dates..  Please help me..   Thanks very much..