Yes, it does. Thanks.
Nu Er Ha Chi
Posts
-
Java Rant -
Java RantI haven't used Java for a while. My company is moving from .NET to Java, so I downloaded the most recent version of J2SE (5.0). I hate it already. How do I build a string as time stamp based on the current time? The format I want is: yyyyMMddHHmmss (i.e. year, month, day, hour, minute, second) With .NET, I need only to do this:
string sTimestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
Here is what I have to do in Java:GregorianCalendar oCal = new GregorianCalendar(); int nYear = oCal.get(Calendar.YEAR); int nMonth = oCal.get(Calendar.MONTH); int nDay = oCal.get(Calendar.DAY_OF_MONTH); int nAMPM = oCal.get(Calendar.AM_PM); int nHour = nAMPM>0?(oCal.get(Calendar.HOUR)+12):oCal.get(Calendar.HOUR); int nMinute = oCal.get(Calendar.MINUTE); int nSecond = oCal.get(Calendar.SECOND); String sTimestamp = new Integer(nYear).toString()+ (nMonth<9?("0"+new Integer(nMonth+1).toString()):new Integer(nMonth+1).toString())+ (nDay<10?("0"+new Integer(nDay).toString()):new Integer(nDay).toString())+ (nHour<10?("0"+new Integer(nHour).toString()):new Integer(nHour).toString())+ (nMinute<10?("0"+new Integer(nMinute).toString()):new Integer(nMinute).toString())+ (nSecond<10?("0"+new Integer(nSecond).toString()):new Integer(nSecond).toString());
Note that the month value returned by oCal.get(Calendar.MONTH) is 0 based, unlike all the other fields. What the ****? :mad: -
JOTD: Instructions for JumpersJosh Gray wrote: Having known someone who chose a similar demise I dont find that funny at all. I think the joke is not that funny, knowing someone who chose a similar demise should have nothing to do with it. If someone close to me fell down and became paralyzed for life, does that mean I cannot laugh at the next person who falls down in a funny way?
-
Developed, Developing, Underdeveloped ... who decides?Pete Madden wrote: Finally...something substantial Just wondering, why Vatican City is considered more economically developed, more representative, and/or less corrupt than, say, Singapore, South Korea, and Hongkong? Does not make any sense.
-
2 Megamembers!Among the 2 million CP accounts: 100,000 of them are for real members 200,000 of them just sign on to read the soapbox The rest are created by People to get the luck ids 1000000 and 2000000 :laugh:
-
Ya know...John Simmons / outlaw programmer wrote: It's really pathetic when people vote on articles based on their politics instead of the technical merit of the article. There is always a possibility that the voters think your article lacks technical merit or it sucks more than your politics. ;P Disclaimer: I never read or voted on your articles.
-
How to anger your customer baseDue to an isolated anomaly in the engineering, development and pattern release process ... In other words, it was caused by problems in design (engineering), coding (development), and QA (release process). How can it still be called an "isolated anomaly"? :laugh:
-
ReorganizationThanks for the advice.
-
ReorganizationI am in the IT division of a large company (over 20000 employees nation wide). This is the first time I have encountered a reorganization that affects me. The team I am currently in (about 15 people) will be moved under a new director. I am a senior developer with no management responsibility and I don't think they will let me go. Just wondering if there is anything I should do or watch out for during such changes? Thanks.
-
A question about road names for USiansDavid Wulff wrote: Is it 10? 70? 180? It is probably all of the above, 10+70+180 = 260. ;)
-
Anti-racial insult lawsDaniel Turini wrote: he said Grafite was a "monkey, and you can take the ball and the banana and stick up in your …” Ok, I can understand it is an insult, but why is it considered a anti-racial insult? Is monkey used by some people in your country to refer to a certain race?
-
Frustrations...David Wulff wrote: Then send an e-mail to your boss afterwards appologising for including him on a private e-mail. That is so cool, why didn't I think of that? Thanks! :)
-
I Think I've Been Insulted...Ed K wrote: My wife pulls something similar often. Goes like this...She askes my opinion on something, I give it, she doesn't believe me, she asks someone else who tells them the same thing I told her so then she believes them. Not me. Your wife too? I thought my wife is the only one. :laugh:
-
I also got a C puzzle#include <stdio.h> void main() { if(printf("Hello, world")) {} }
-
I also got a C puzzleHere is an entire program without semi colon: void main() {} ;P
-
To VB or not to VBRyan Roberts wrote: IN VB6, its possible but involves massive hacks such as using a filesystem object for IO. I never did or liked VB console applications myself but I have seen people doing it with no problem/hack at all. If someday C++ programmers are accused of being ignorant or closed minded, you could be partially responsible for it. BTW, I am not a VB programmer nor do I like VB more than C++.
-
To VB or not to VBFranz Klein wrote: Can VB6 or VB .NET be used for creating console applications? Yes, here is a VB.NET version:
Module Module1 Sub Main() System.Console.WriteLine("Hello, world") End Sub End Module
If you want to convince others that VB is bad or evil, make sure your point is based on facts instead of anger. -
Borrowing code…Christian Graus wrote: I had an argument with my mother in law last night. She's advising me that when I go to Singapore in a few weeks, I should buy lots of DVD's and video games. If it is sold legally in the country, why is it stealing? It is taking advantages of uneven levels of living standards in different countries. People can buy things real cheap from your own country and know very well they are most likely made in a third world country by a under aged worker (which is illegal in your country). I bet most of the under aged workers will hate you if you decide not to "steal" from them.
-
Weapons and ChinaK(arl) wrote: Selling weapons to a dictatorship is not a smart move to improve human rights. Damn you anti-Americans! :laugh:
-
CP Ads - Missing point?Nishant S wrote: A few authors said that they were going to remove their articles from CP. I seriously doubt if any of those people would dare to do that. If they did so, then they'd lose 99% of their viewership As a CP employee, you are not supposed to talk like that. You probably already offended those authors. Doesn't CP offer "sensitivity training" to its employees? :-D