Issue converting a string value to an int
<p>Below is a snippet of my code.</p>

<pre><code>    private String makeDayCode(String unlockCode, String code) {
        // TODO Auto-generated method stub
        int intUnlockCode = 0;


        int[] newDateArray = new int[8];

        Log.v (LOG_TAG, "tick  ");

        SimpleDateFormat s = new SimpleDateFormat("yyyyMMdd");
        String dateTime = s.format(new Date());

        Log.v (LOG_TAG, "tick 2:"+ dateTime + ".");


        Log.v (LOG_TAG, "tick  3:"+Integer.valueOf(dateTime)+".");


        int intDate = Integer.valueOf(dateTime);

        Log.v (LOG_TAG, "tick  3.1" + Integer.parseInt(unlockCode) + ".");
</code></pre>

<p>The following is from my logcat, showing the values of dateTime in the Log msgs.</p>

<pre><code>02-23 21:03:57.415: V/dbtest(15552): tick 2:20130223.
02-23 21:03:57.415: V/dbtest(15552): tick  3:20130223.
</code></pre>

<p>The problem i am having is that i am having the following error message:</p>

<pre><code>java.lang.NumberFormatException: Invalid int: ""
</code></pre>

<p>which causes my code to fail before the Log with tick 3.1 - narrowing my issue to the line:</p>

<pre><code>int intDate = Integer.valueOf(dateTime);
</code></pre>

<p>From researching it would appear that for some reason dateTime is not being converted from a String to an int. I think because it isnt a string, or has no value. however the log cat on tick 2 and tick 3 show that dateTime has a value of 20130223.</p>

<p>Can anyone shed some light on why i am getting this exception?</p>

<p>Mucho thanks in advance</p>
