473,320 Members | 1,957 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to autoformat time

Hi.

how to when i wrote the time on input it shows two points automatic? (12:23)

Regards, José.

Jul 23 '05 #1
2 2196
"Jose" <s.*****@terra.es> wrote in message
news:Wk**********************@telenews.teleline.es ...
Hi.

how to when i wrote the time on input it shows two points automatic? (12:23)
Regards, José.


Will this help: watch for word-wrap.

<html>
<head>
<title>hour_min.htm</title>
</head>
<body>
<script type="text/javascript">
var d = new Date();
var h = ((d.getHours()+100)+"").substr(1,2);
var m = ((d.getMinutes()+100)+"").substr(1,2);
var t = h + ":" + m;
document.write(t);
</script>
</body>
</html>
Jul 23 '05 #2
JRS: In article <oGybd.126897$He1.17615@attbi_s01>, dated Thu, 14 Oct
2004 17:27:48, seen in news:comp.lang.javascript, McKirahan
<Ne**@McKirahan.com> posted :
"Jose" <s.*****@terra.es> wrote in message
news:Wk**********************@telenews.teleline.e s...
how to when i wrote the time on input it shows two points automatic?

(12:23)

Will this help: watch for word-wrap. var d = new Date();
var h = ((d.getHours()+100)+"").substr(1,2);
var m = ((d.getMinutes()+100)+"").substr(1,2);
var t = h + ":" + m;
document.write(t);


That's not a particularly good way of adding a leading zero in
javascript, though it is in VBScript.

I'd use

function LZ(x) { return (x<0||x>=10?"":"0") + x } // included

var t = LZ(d.getHours() + ':' + LZ(d.getMinutes())

Unless there are systems that give FFF times,

var t = String(d).match(/..:../) // should do.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bart Nessux | last post by:
am I doing this wrong: print (time.time() / 60) / 60 #time.time has been running for many hours if time.time() was (21600/60) then that would equal 360/60 which would be 6, but I'm not getting...
5
by: David Stockwell | last post by:
I'm sure this has been asked before, but I wasn't able to find it. First off I know u can't change a tuple but if I wanted to increment a time tuple by one day what is the standard method to do...
1
by: Catherine Jo Morgan | last post by:
If I use the autoformat option in Access2002 to make a form look a certain way, using the Form Design Wizard, is it possible to change later to a different autoformat option? If so, how? I've...
6
by: Rebecca Smith | last post by:
Today’s question involves two time text boxes each set to a different time zone. Initially txtCurrentTime will be set to Pacific Time or system time. This will change with system time as we travel...
0
by: Steven Blair | last post by:
Is it possible to add more format choices to the autoformat in the DataGridView. I have a particular stlye for my DGV's and wish to save this out so I can easily re-use, preferebly through the...
2
by: Eirik Eldorsen | last post by:
Is it possible to completely turn off autoformat in visual studio 2003? In the options, I've unchecked autoformat when save and autoformat on switch between design/html. But that does not stop...
2
by: Micah Williamson | last post by:
Does anyone know how to make it so that a time entered as a string, and stored in a string record in an access 2000 database can be kept as a string? When ever I enter a time like 1:00:00 PM...
5
by: BartlebyScrivener | last post by:
I'm new to both Perl & Python. Is there a Python module or script somewhere comparable to the useful Perl module - Text::Autoformat? Thanks, BS
1
by: JJGarcia | last post by:
Hi everyone, I am not an expert in Visual basic, so excuse me if you guys find my question a little too easy, you'll see, I played around sometime with Visual Express 2005 then, I finally got mi...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.