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: 
The program causes undefined behaviour by violating the strict aliasing rule (a `double` object is written via an expression of incompatible type `int`).

So the behaviour of the program is not covered by the rules of the language . For further reading see [Undefined, unspecified and implementation-defined behavior](https://stackoverflow.com/questions/2397984/undefined-unspecified-and-implementation-defined-behavior)
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>