Question: The `Now()` function displays the date.

The `addDays()` function allows you to add days to the date.

The problem is that the date display the timezone:
`2021-01-07T08: 00: 33.000Z`

**I want**: `2021-01-07 08:00:00`

Anyone have any help please?

```js
function NOW() {

   var date = new Date();
   var aaaa = date.getFullYear();
   var gg = date.getDate();
   var mm = (date.getMonth() + 1);

   if (gg < 10)
       gg = "0" + gg;

   if (mm < 10)
       mm = "0" + mm;

   var cur_day = aaaa + "-" + mm + "-" + gg;

   var hours = date.getHours()
   var minutes = date.getMinutes()
   var seconds = date.getSeconds();

   if (hours < 10)
       hours = "0" + hours;

   if (minutes < 10)
       minutes = "0" + minutes;

   if (seconds < 10)
       seconds = "0" + seconds;

   return cur_day + " " + hours + ":" + minutes + ":" + seconds;

}
function addDays(date, days) {
   var result = new Date(date);
   result.setDate(result.getDate() + days);
   return result;
 }

```

Answer: 
> 
> So what exactly is happening here?
> 
> 
> 

Since this is UB, you won’t find an answer in the C standard, and thus how do you expect to find an answer while looking at C code? Clearly the C code won’t tell you much. You need to look at the assembly output, and that’s missing from your question, making it incomplete. That probably explains the downvotes: you didn’t provide sufficient information.

But you don’t need to ask us: go to godbolt, choose your compiler, see the assembly output, add an executor and also see the result of running the program, so you can correlate the output with generated assembly. Make sure to select the same compiler version and platform as the one you’ve used to obtain original behavior - don’t forget the optimization level argument to the compiler (aka compiler flag), ie. if there was a `-Osomething` flag used when you compiled it, the same one is needed to be passed to both the compiler and the executor on godbolt.

Once you get the assembly output - either by providing the `-s` flag to the compiler on your computer, or by copying it from godbolt, you can then add that to the question, do some work on figuring out what’s going on, and add the real question you got - related to the assembly - if you won’t be able to see how the assembly code produces the output you see.

But don’t ask why the compiler produced such assembly code: UB means that it’s allowed to produce such assembly :) UB is in some ways a carte blanche: the compiler shouldn’t be malicious, but it doesn’t need to be “nice” about it, and thus the generated code may be *highly* unintuitive.
As other colleagues stated it is the UB.
But abstracting from it `float` has different binary representation than the `int`. So `"2.0f"` will be stored in the memory than the `"2"`. You can check it using a very simple program:

```
#include <stdio.h>
#include <string.h>

float x = 2.0f;
int y = 2;
unsigned char bytes[sizeof(x)];

int main(void)
{

    if(sizeof(y) == sizeof(x))
    {
        memcpy(bytes, &x, sizeof(bytes));

        printf("float %f is in binary: ", x);
        for(size_t i = 0; i < sizeof(bytes); i++)
        {
            printf("%hhx ", bytes[i]);
        }

        memcpy(bytes, &y, sizeof(bytes));

        printf("\n\nint %d is in binary: ", y);
        for(size_t i = 0; i < sizeof(bytes); i++)
        {
            printf("%hhx ", bytes[i]);
        }

        memcpy(&x, &y, sizeof(x));

        printf("\n\nfloat %f after integer representation of integer 2 copy\n", x);
    }

}

```

result:

```
x86-64 gcc 10.2

Program returned: 0
Program stdout

float 2.000000 is in binary: 0 0 0 40 

int 2 is in binary: 2 0 0 0 

float 0.000000 after integer representation of integer 2 copy

```

In this program `memcpy(&x, &y, sizeof(x));` does exactly the same thing as your pointer assignment, but does it the correct way.

EDIT: Also double version here <https://godbolt.org/z/fxccjf>