Common Questions with Date Format
1. What are the possbile date formats?
2. Can I use any delimiter?
I couldn't find a concrete explanation of the possible date formats but I decided to write one based on trial and and error.
Date dateNow = new Date();
a.
System.out.println(dateNow);
Output: Fri Oct 19 09:26:59 CST 2012
b.
String dateStr = new SimpleDateFormat("MMM/dd/yyyy").format(dateNow);
System.out.println(dateStr);
Output: Oct/19/2012
Use MMM to get Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
Note: If the output month is not in the format "Oct", you can try adding Locale.ENGLISH:
String df = new SimpleDateFormat("MMM/dd/yyyy", Locale.ENGLISH).format(dateNow);
c.
String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(dateNow);
System.out.println(dateStr);
Output: 2012-10-19
d.
String dateStr = new SimpleDateFormat("yyyy/mm/dd").format(dateNow);
System.out.println(dateStr);
Output: 2012/38/19
Note : In letter D, the output is supposedly 2012/10/19. However, you are using the format "yyyy/mm/dd". The month variable should be in capitals, MM instead of mm.
Note : Also make sure that your year variable are in small letters, yyyy instead of YYYY. It will return an error.
As you can see, the format can be interchangeable.
2. Can I use any delimiter? Yes.
Showing posts with label Eclipse. Show all posts
Showing posts with label Eclipse. Show all posts
Thursday, 18 October 2012
Tuesday, 7 August 2012
Eclipse: Java was started but returned exit code = 1
If you are recently faced with this error, it may or may not have something to do with your JDK or JRE.
Solution: Do a clean install of Eclipse, JDK and JRE again. I think is the best solution instead of configuring something from the .ini file.
Solution: Do a clean install of Eclipse, JDK and JRE again. I think is the best solution instead of configuring something from the .ini file.
Adding a new android platform in Eclipse
When we develop applications for Android, sometimes we need more than one platform. I will show you how to add a new one in your existing.
Go to Window > Android SDK Manager
Wait for it to load and a list of packages will be displayed.
Select the platform that you want and click Install packages..
A new window will open with the list packages to be installed, click Accept and wait for the download to finish.
Et voila, you can now create apps for that specific platform.
Go to Window > Android SDK Manager
Wait for it to load and a list of packages will be displayed.
Select the platform that you want and click Install packages..
A new window will open with the list packages to be installed, click Accept and wait for the download to finish.
Et voila, you can now create apps for that specific platform.
Installing Android in Eclipse
What you'll need:
Eclipse (I use Helios Indigo 3.7.2)
Where: www.eclipse.org/downloads/
How: http://eclipsetutorial.sourceforge.net/totalbeginner.html
Android SDK
Where:http://developer.android.com/sdk/index.html
There are two components in order to develop applications in Android. First, the SDK then the ADT.
1. Go to http://developer.android.com/sdk/index.html and download the SDK that fits your system.
2. Download the ADT Plugin
Go to help > install new software > add
A dialog will appear
Name: ADT Plugin
Location: https://dl-ssl.google.com/android/eclipse/
3. If there are troubles with the location URL, try using http instead of https.
4. Click OK and wait.
5. You will then see a new screen with a list of tools to be downloaded.
6. Select the checkbox for Developer Tools and click Next.
7. The read and accept license will then show up,read accept it then click finish.
8. Installation is now complete and you may restart eclipse.
After this, you have to modify the ADT to be able to use the Android SDK on Eclipse.
9. Select window > preferences
10. On the left side, you will see Android. Click Android. A screen like below should appear.
11. Click Browse and locate where you previously downloaded the SDK.
12. Click apply then OK .
Eclipse (I use Helios Indigo 3.7.2)
Where: www.eclipse.org/downloads/
How: http://eclipsetutorial.sourceforge.net/totalbeginner.html
Android SDK
Where:http://developer.android.com/sdk/index.html
There are two components in order to develop applications in Android. First, the SDK then the ADT.
1. Go to http://developer.android.com/sdk/index.html and download the SDK that fits your system.
2. Download the ADT Plugin
Go to help > install new software > add
A dialog will appear
Name: ADT Plugin
Location: https://dl-ssl.google.com/android/eclipse/
3. If there are troubles with the location URL, try using http instead of https.
4. Click OK and wait.
5. You will then see a new screen with a list of tools to be downloaded.
6. Select the checkbox for Developer Tools and click Next.
7. The read and accept license will then show up,read accept it then click finish.
8. Installation is now complete and you may restart eclipse.
After this, you have to modify the ADT to be able to use the Android SDK on Eclipse.
10. On the left side, you will see Android. Click Android. A screen like below should appear.
11. Click Browse and locate where you previously downloaded the SDK.
12. Click apply then OK .
Installing Eclipse
You can get Eclipse by going to http://www.eclipse.org/download. To know which version you should get, refer to my previous post.
It is advisable that you download the latest version which, as of now, is Eclipse Indigo. After downloading, you will have a .zip file of Eclipse.
Note: It is also advisable that you unpack the .zip Eclipse file into a directory path that does not contain spaces in its name because sometimes, it can cause problems.
After unpacking, you can already see the eclipse.exe file, which indicates that Eclipse is ready to be used with no installation required.
It is advisable that you download the latest version which, as of now, is Eclipse Indigo. After downloading, you will have a .zip file of Eclipse.
Note: It is also advisable that you unpack the .zip Eclipse file into a directory path that does not contain spaces in its name because sometimes, it can cause problems.
After unpacking, you can already see the eclipse.exe file, which indicates that Eclipse is ready to be used with no installation required.
Eclipse 101
Eclipse is a software development application that allows developers to create Java applications. However, since Eclipse has an extensible plug-in system, developers can also create applications using C, C++, COBOL, Python etc.
How do I get it?
When you go to the eclipse download site, you can see that there are different types of Eclipse. But these are not types. They are just VERSIONS named after the solar system. To sum it up,
source: http://wiki.eclipse.org/Older_Versions_Of_Eclipse
Which Eclipse should I get?
In every eclipse version, they also have different packages. To know more, check out: http://www.eclipse.org/downloads/compare.php
However, I would discuss the three top downloaded Eclipse IDE which are:
Eclipse IDE for Java EE Developer: Used mainly for building and running enterprise software, widely used for server programming, in other words, used for Web Development.
Eclipse IDE for Java Developer: Used mainly to build java applications.
Eclipse Classic:The basic eclipse without the EE part - support for web development.
How do I get it?
When you go to the eclipse download site, you can see that there are different types of Eclipse. But these are not types. They are just VERSIONS named after the solar system. To sum it up,
| Release | Date | Platform |
| Indigo | 2011 | 3.7 |
| Helios | 2010 | 3.6 |
| Galileo | 2009 | 3.5 |
| Ganymede | 2008 | 3.4 |
| Europa | 2007 | 3.3 |
| Callisto | 2006 | 3.2 |
| Eclipse 3.1 | 2005 | 3.1 |
| Eclipse 3.0 | 2004 | 3.0 |
source: http://wiki.eclipse.org/Older_Versions_Of_Eclipse
Which Eclipse should I get?
In every eclipse version, they also have different packages. To know more, check out: http://www.eclipse.org/downloads/compare.php
However, I would discuss the three top downloaded Eclipse IDE which are:
- Eclipse Classic
- Eclipse IDE for Java EE Developer
- Eclipse IDE for Java Developer
Eclipse IDE for Java Developer: Used mainly to build java applications.
Subscribe to:
Posts (Atom)




