EspañolDeutschFrançaisItalianoPortuguêsРусскийΕλληνικά日本語中文(简体)हिन्दी; हिंदीالعربية
Сделать основным языком
PF вопросы - Форум

Получить текущий год в Javascript

¿Cómo obtengo el año actual en Javascript?

Share on Facebook Tweet about this on Twitter Share on Google+ Pin on Pinterest Share on Reddit Share on VK Share on StumbleUpon Share on Tumblr Share on LinkedIn Email this to someone Print this page
juanma21 спросил ли 7 лет
1 Ответы

Muy simple. Crea un objeto de tipo Дать вам() y llama al método getFullYear()

var fecha = new Date();
var anyo = fecha.getFullYear();

//o de forma más simple
var anyo = new Date().getFullYear();

 

Share on Facebook Tweet about this on Twitter Share on Google+ Pin on Pinterest Share on Reddit Share on VK Share on StumbleUpon Share on Tumblr Share on LinkedIn Email this to someone Print this page
Питер Блайт Саид делает 7 лет