You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
: Creează data cu componentele date în fusul orar local. Doar primele două argumente sunt obligatorii.
59
59
60
-
- The `year` should have 4 digits. For compatibility, 2 digits are also accepted and considered `19xx`, e.g.`98` is the same as `1998` here, but always using 4 digits is strongly encouraged.
61
-
- The `month` count starts with `0` (Jan), up to `11` (Dec).
62
-
- The `date` parameter is actually the day of month, if absent then `1` is assumed.
63
-
- If `hours/minutes/seconds/ms` is absent, they are assumed to be equal `0`.
60
+
- Anul `year` trebuie să aibă 4 cifre. Pentru compatibilitate, sunt acceptate și 2 cifre, care sunt considerate `19xx`, e.g.`98` este același lucru cu `1998` aici, dar este întotdeauna puternic încurajată folosirea a 4 cifre.
61
+
- Numărătoarea "lunilor" începe cu `0` (Ian), până la `11` (Dec).
62
+
- Parametrul `date` este de fapt ziua lunii, dacă nu există atunci se presupune `1`.
63
+
- Dacă `ore/minute/secunde/ms` este absent, se presupune că sunt egale cu `0`.
64
64
65
-
For instance:
65
+
De exemplu:
66
66
67
67
```js
68
68
new Date(2011, 0, 1, 0, 0, 0, 0); // 1 Jan 2011, 00:00:00
69
-
new Date(2011, 0, 1); // the same, hours etc are 0 by default
69
+
new Date(2011, 0, 1); // la fel, orele etc sunt 0 în mod implicit
70
70
```
71
71
72
-
The maximal precision is 1 ms (1/1000 sec):
72
+
Precizia maximă este 1 ms (1/1000 sec):
73
73
74
74
```js run
75
75
let date = new Date(2011, 0, 1, 2, 3, 4, 567);
76
76
alert( date ); // 1.01.2011, 02:03:04.567
77
77
```
78
78
79
-
## Access date components
79
+
## Accesarea componentelor de date
80
80
81
-
There are methods to access the year, month and so on from the `Date` object:
81
+
Există metode pentru a accesa anul, luna și așa mai departe din obiectul `Date`:
82
82
83
83
[getFullYear()](mdn:js/Date/getFullYear)
84
-
: Get the year (4 digits)
84
+
: Obține anul (4 cifre)
85
85
86
86
[getMonth()](mdn:js/Date/getMonth)
87
-
: Get the month, **from 0 to 11**.
87
+
: Obține luna, **de la 0 la 11**.
88
88
89
89
[getDate()](mdn:js/Date/getDate)
90
-
: Get the day of month, from 1 to 31, the name of the method does look a little bit strange.
90
+
: Obține ziua lunii, de la 1 la 31, numele metodei pare puțin ciudat.
Many JavaScript engines implement a non-standard method `getYear()`. This method is deprecated. It returns 2-digit year sometimes. Please never use it. There is `getFullYear()`for the year.
95
+
```warn header="Nu`getYear()`, ci`getFullYear()`"
96
+
Multe motoare JavaScript implementează o metodă non-standard `getYear()`. Această metodă este depreciată. Ea returnează uneori anul din 2 cifre. Vă rugăm să nu o folosiți niciodată. Există `getFullYear()`pentru an.
97
97
```
98
98
99
-
Additionally, we can get a day of week:
99
+
Adițional, putem obține o zi a săptămânii:
100
100
101
101
[getDay()](mdn:js/Date/getDay)
102
-
: Get the day of week, from `0` (Sunday) to `6` (Saturday). The first day is always Sunday, in some countries that's not so, but can't be changed.
102
+
: Obține ziua săptămânii, de la `0` (Duminică) la `6` (Sâmbătă). Prima zi este întotdeauna Duminică, în unele țări nu este așa, dar nu poate fi schimbată.
103
103
104
-
**All the methods above return the components relative to the local time zone.**
104
+
**Toate metodele de mai sus returnează componentele în raport cu fusul orar local.**
105
105
106
-
There are also their UTC-counterparts, that return day, month, year and so on for the time zone UTC+0: [getUTCFullYear()](mdn:js/Date/getUTCFullYear), [getUTCMonth()](mdn:js/Date/getUTCMonth), [getUTCDay()](mdn:js/Date/getUTCDay). Just insert the `"UTC"` right after `"get"`.
106
+
Există de asemenea omologii lor UTC, care returnează ziua, luna, anul și așa mai departe pentru fusul orar UTC+0: [getUTCFullYear()](mdn:js/Date/getUTCFullYear), [getUTCMonth()](mdn:js/Date/getUTCMonth), [getUTCDay()](mdn:js/Date/getUTCDay). Doar introduceți `"UTC"` imediat după `"get"`.
107
107
108
-
If your local time zone is shifted relative to UTC, then the code below shows different hours:
108
+
Dacă fusul orar local este decalat față de UTC, atunci codul de mai jos afișează ore diferite:
0 commit comments