# Update the second text

**URL:** <https://discourse.processing.org/t/update-the-second-text/18275>\
**Category:** Coding Questions\
**Created:** [March 1, 2020, 12:29pm UTC](https://discourse.processing.org/t/update-the-second-text/18275 "2020-03-01T12:29:31Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Post date:** [March 1, 2020, 12:29pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/1 "2020-03-01T12:29:31Z")

</div>

I need Help i would update the second Text can everyone help me

Text:

```auto
int sekunde = second();
int minute = minute();
int stunde = hour();
int tag = day();
int monat = month(); 
int yahr = year();

void setup(){
  fullScreen();
  background(0);
  frameRate(90);
  textSize(200);
  String s = String.valueOf(tag);
  text(s, 750, 450);
  text(".", 850, 450);
  s = String.valueOf(monat);
  text(s, 900, 450);
  text(".", 1000, 450);
  s = String.valueOf(yahr);
  text(s, 1050, 450);
  textSize(90);
  s = String.valueOf(sekunde);
  text(s, 750, 520);
  orientation(LANDSCAPE);
}

```

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [March 1, 2020, 1:12pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/2 "2020-03-01T13:12:02Z")

</div>

I guess you will need to put the code in the draw() function with second() included

---

<div class="post-metadata">

**Author:** ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Post date:** [March 1, 2020, 1:18pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/3 "2020-03-01T13:18:42Z")

</div>

Unfortunately it does not work

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 1, 2020, 1:20pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/4 "2020-03-01T13:20:58Z")

</div>

Hello,

Please format your code:  
[https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)

setup() only runs once:  
[https://processing.org/reference/setup\_.html](https://processing.org/reference/setup_.html)  
The reference above also has related items such as draw()

Additional references:  
[https://processing.org/](https://processing.org/)  
[https://processing.org/tutorials/overview/](https://processing.org/tutorials/overview/)

`:)`

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 1, 2020, 1:26pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/5 "2020-03-01T13:26:35Z")

</div>

It does work if you put the code in draw() as @noel suggested.

You will have to put the correct code on draw().

Another reference:  
[https://processing.org/examples/variablescope.html](https://processing.org/examples/variablescope.html)

`:)`

---

<div class="post-metadata">

**Author:** ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Post date:** [March 1, 2020, 1:28pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/6 "2020-03-01T13:28:55Z")

</div>

Ist work Thanks​:heart:❤❤😃😃😃😃

---

<div class="post-metadata">

**Author:** ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Post date:** [March 1, 2020, 5:52pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/7 "2020-03-01T17:52:05Z")

</div>

Why is now the time not working?

```auto
int start = 0;
int sekunde;
int minute;
int stunde;
int tag;
int monat;
int yahr;

void update(){
  sekunde = second();
  minute = minute();
  stunde = hour();
  tag = day();
  monat = month();
  yahr = year();
}

void setup(){
  fullScreen();
  frameRate(90);
}
  
void draw(){
  if(start == 0){
    background(255);
    delay(2000);
    start = 1;
  if(start == 1){
    background(0);
    update();
    textSize(200);
    String s = String.valueOf(tag);
    fill(#FFFFFF);
    update();
    text(s, 750, 450);
    text(".", 850, 450);
    s = String.valueOf(monat);
    update();
    text(s, 900, 450);
    text(".", 1000, 450);
    s = String.valueOf(yahr);
    update();
    text(s, 1050, 450);
    textSize(75);
    s = String.valueOf(sekunde);
    update();
    text(":", 1157, 595);
    text(s, 1175, 600);
    s = String.valueOf(minute);
    update();
    text(s, 1075, 600);
    text(":", 1055, 595);
    s = String.valueOf(stunde);
    update();
    text(s, 975, 600);
    update();
    orientation(LANDSCAPE);
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 1, 2020, 6:02pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/8 "2020-03-01T18:02:27Z")

</div>

That is an easy one!

> [@glv](#):
>
> Please format your code:  
> [https://discourse.processing.org/faq#format-your-code](https://discourse.processing.org/faq#format-your-code)

Please format your code and I will consider assisting further.

---

<div class="post-metadata">

**Author:** ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Post date:** [March 1, 2020, 6:25pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/9 "2020-03-01T18:25:24Z")

</div>

I have changed the text

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 1, 2020, 6:30pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/10 "2020-03-01T18:30:51Z")

</div>

You have an _if_ statement inside of an _if_ so the condition of 1 is set but on next pass it only checks for a 0.

You should have 2 _if_ statements or an _if else_.

`:)`

---

<div class="post-metadata">

**Author:** ![MonteliaRO](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monteliaro/32/8303_2.png) [@MonteliaRO](https://discourse.processing.org/u/MonteliaRO)\
**Post date:** [March 1, 2020, 6:41pm UTC](https://discourse.processing.org/t/update-the-second-text/18275/11 "2020-03-01T18:41:52Z")

</div>

I habe fix that thanks for you help
