- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
var currentDate = new Date();
var currentDay = currentDate.getDay();
var currentMonth = currentDate.getMonth();
var currentYear = currentDate.getYear();
var currentHour = currentDate.getHours();
var currentMinute = currentDate.getMinutes();
var currentSecond = currentDate.getSeconds();
if (currentMonth < 10) {
currentMonth = '0' + currentMonth;
}
if (currentDay < 10) {
currentDay = '0' + currentDay;
}
if (currentHour < 10) {
currentHour = '0' + currentHour;
}
if (currentMinute < 10) {
currentMinute = '0' + currentMinute;
}
if (currentSecond < 10) {
currentSecond = '0' + currentSecond;
}
striker 25.09.2009 12:05 # −1
guest 25.09.2009 13:06 # +1
Smoke 28.09.2009 10:39 # +1
и первой ссылкой получаю прекрасную реализацию:
http://blog.stevenlevithan.com/archives/date-time-format
guest 28.09.2009 18:03 # +1
while (val.length < len) val = "0" + val;
внутри http://blog.stevenlevithan.com/archives/date-time-format
WGH 25.09.2009 13:09 # 0
MV28jam 25.09.2009 13:13 # 0
guest 25.09.2009 14:26 # 0
И где больший говнокод?
MV28jam 25.09.2009 15:06 # 0
guest 25.09.2009 16:30 # 0
MV28jam 25.09.2009 16:35 # −2
Suor 29.09.2009 12:24 # 0
MV28jam 29.09.2009 13:08 # 0
guest 01.10.2009 09:04 # 0
MV28jam 01.10.2009 10:14 # 0
guest 23.12.2009 18:08 # 0
Sadie 25.09.2009 15:24 # −2
Oleg_quadro 25.09.2009 23:17 # 0
Crec 26.09.2009 01:07 # +3
Init: function ( time )
{
var Times = {
Day: time.getDay(),
Month: time.getMonth(),
Year: time.getYear(),
Hour: time.getHours(),
Minute: time.getMinutes(),
Second: time.getSeconds()
};
for ( var key in Times )
{
if ( key > 10 ) key = '0' + key;
}
return Times;
}
}
var Date = MyDate.Init( new Date() );
Smoke 28.09.2009 10:36 # +1
Sadie 30.09.2009 13:32 # −2
guest 24.10.2009 13:28 # 0
так что все вы тут эти самые )
Crec 27.10.2009 17:21 # 0
zantor 03.11.2009 12:28 # −1
guest 07.11.2009 18:46 # −1
if ( key > 10 ) key = '0' + key;
zantor 09.11.2009 01:51 # 0
guest 09.11.2009 23:33 # 0
guest 31.12.2009 02:22 # 0