Jump to content
  • 0

Как перевести время?


Andrew_las
 Share

Question

Возможно ли перевести время в php скрипте на час позже?

Вот скрипт


obj_hours=document.getElementById("hours");

name_moscow=new Array ("Московское время")
name_month=new Array ("Января","Февраля","Марта", "Апреля","Мая", "Июня","Июля","Августа","Сентября", "Октября","Ноября","Декабря");
name_day=new Array ("Воскресенье","Понедельник", "Вторник","Среда","Четверг", "Пятница","Суббота");

function wr_hours()
{
time=new Date();

time_sec=time.getSeconds();
time_min=time.getMinutes();
time_hours=time.getHours();
time_wr=((time_hours<10)?"0":"")+time_hours;
time_wr+=":";
time_wr+=((time_min<10)?"0":"")+time_min;
time_wr+=":";
time_wr+=((time_sec<10)?"0":"")+time_sec;

time_wr="       "+name_moscow +"       "+time_wr;

obj_hours.innerHTML=time_wr;
}

wr_hours();
setInterval("wr_hours();",1000);

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

time_hours=time.getHours()-1; ?

Ну конечно не всё так просто есть же и пограничное между сутками время, но тут уже через условие...

P.s. У вас не php скрипт , а javascript , это в другой раздел

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy