Solved Date does not change!

Discussion in 'Plugin Development' started by zDubsCrazy, Feb 4, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    I am using the following code to get the date and time currently:

    Date now = new Date();
    SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
    String hour = format.format(now);
    Whenever I use the String 'hour', she always returns the same value.

    Thanks in advance.
  2. Offline


    That's because you are using the same variable over and over, if you want it to update you need to create a new Date object each time (no need to create a new SimpleDateFormat) :p
    zDubsCrazy likes this.
  3. Offline


  4. Offline


    Never knew there are genders for code. :p
    Last edited: Feb 4, 2015
  5. Offline


    Complain to the Google translator, he made that mistake.
    leon3001 likes this.
Thread Status:
Not open for further replies.

Share This Page