Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18599

Re: How do I get current time in hh:mm

Newsgroups comp.lang.javascript
Subject Re: How do I get current time in hh:mm
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <kg80ll$u70$1@dont-email.me> <1a679606-83c6-4dc8-8224-98135cfb4882@googlegroups.com> <3u1gi8h18qd6ik71erdd01i2u328eoekcr@4ax.com>
Date 2013-02-23 11:04 +0100
Message-ID <XnsA17070ABE82CDeejj99@194.109.133.133> (permalink)

Show all headers | View raw


Jim T. wrote on 23 feb 2013 in comp.lang.javascript:

> On Fri, 22 Feb 2013 14:58:11 -0800 (PST), dann90038@gmail.com wrote:
> 
>>To tony
>>
>>var d = new Date();
>>d.getHours()%12+':'+d.getMinutes();
> 
> Not quite. 

Indeed, that only sort of works for US-of-A-ers.

[and even they would object to "11:8", I suppose.]

The Q was: hh:mm

Please OP, put your Q also in the text, next time,
and include your [failed] effords.

============================
var d = new Date();

document.write(two(d.getHours())+':'+two(d.getMinutes()));

function two(x){
  return (x<10)?'0'+x:''+x;
};
============================


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How do I get current time in hh:mm "Tony" <tony.johansson@inport.com> - 2013-02-22 15:52 +0100
  Re: How do I get current time in hh:mm dann90038@gmail.com - 2013-02-22 14:58 -0800
    Re: How do I get current time in hh:mm Jim T. <x@y.z> - 2013-02-22 19:06 -0500
      Re: How do I get current time in hh:mm "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-23 11:04 +0100
        Re: How do I get current time in hh:mm Mike Duffy <Use.web.form@website_in_sig.com> - 2013-02-23 16:44 +0000
          Re: How do I get current time in hh:mm "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-23 23:39 +0100
            Re: How do I get current time in hh:mm Mike Duffy <Use.web.form@website_in_sig.com> - 2013-02-24 21:38 +0000
              Re: How do I get current time in hh:mm "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-02-25 00:16 +0100
    Re: How do I get current time in hh:mm Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-02-23 21:13 +0000
    Re: How do I get current time in hh:mm Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-24 19:37 +0100
      Re: How do I get current time in hh:mm Tim Streater <timstreater@greenbee.net> - 2013-02-24 18:49 +0000
        Re: How do I get current time in hh:mm Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-24 19:56 +0100
          Re: How do I get current time in hh:mm Tim Streater <timstreater@greenbee.net> - 2013-02-24 19:26 +0000
            Re: How do I get current time in hh:mm Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-24 22:30 +0100
              Re: How do I get current time in hh:mm Tim Streater <timstreater@greenbee.net> - 2013-02-24 23:00 +0000
        Re: How do I get current time in hh:mm Anders Wegge Keller <wegge@wegge.dk> - 2013-02-24 19:59 +0100
      Re: How do I get current time in hh:mm Richard Yates <richard@yatesguitar.com> - 2013-02-24 12:35 -0800
        Re: How do I get current time in hh:mm Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-24 22:23 +0100
          Re: How do I get current time in hh:mm Richard Yates <richard@yatesguitar.com> - 2013-02-24 20:40 -0800
            Re: How do I get current time in hh:mm Andrew Poulos <ap_prog@hotmail.com> - 2013-02-25 16:17 +1100
              Re: How do I get current time in hh:mm Richard Yates <richard@yatesguitar.com> - 2013-02-25 10:45 -0800
      Re: How do I get current time in hh:mm John G Harris <niam@jghnorth.org.uk.invalid> - 2013-02-25 10:04 +0000

csiph-web