Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Now -- populating textbox with date/time stamp

Reply
Thread Tools

Now -- populating textbox with date/time stamp

 
 
middletree
Guest
Posts: n/a
 
      07-25-2005
Is there a script that will populate, with a click, a textbox with the
equivalent of the ASP/VBScript Now() function? In ohter words, I'd like it
to be in this format:

7/25/2005 10:58:39 AM



 
Reply With Quote
 
 
 
 
microchip
Guest
Posts: n/a
 
      07-25-2005
See this Page:

http://www.devguru.com/Technologies/...kref/date.html

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      07-25-2005


middletree wrote:

> Is there a script that will populate, with a click, a textbox with the
> equivalent of the ASP/VBScript Now() function? In ohter words, I'd like it
> to be in this format:
>
> 7/25/2005 10:58:39 AM


VBScript's Now result is locale dependent, for instance on my system I
get e.g.
25.07.2005 18:52:51
As for JavaScript, you get a Date object with current date and time with
var now = new Date();
then you need to write your own function to create some output format
like you want.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Dr John Stockton
Guest
Posts: n/a
 
      07-25-2005
JRS: In article <42e516c2$0$11950$ ws.ne
t>, dated Mon, 25 Jul 2005 11:43:11, seen in news:comp.lang.javascript,
middletree <> posted :
>Is there a script that will populate, with a click, a textbox with the
>equivalent of the ASP/VBScript Now() function? In ohter words, I'd like it
>to be in this format:
>
>7/25/2005 10:58:39 AM


The default assumption in this newsgroup is that script is for the
World-Wide Web : note the first two W characters in particular.

That's a damfool format for use internationally, since a very
substantial majority of countries use either YYYY MM DD or DD MM YYYY,
which each have the numeric fields in a logical order.

Therefore, for numeric dates, one should always use the unambiguous form
YYYY MM DD - it is believed that even Americans can understand it.

One should also, of course, use the 24-hour clock - same comment.


By the way, you are wrong in saying that VBS Now() returns that form; it
does not, it returns a value of variant CDate, which is a count of days
(probably in IEEE Double format) from 1899-12-30 00:00:00 local time.
One can do simple arithmetic - addition and subtraction - on that CDate
and it remains a CDate. It is the conversion from CDate to string that
imposes a character-based format on the data; that format is localised,
and it is not always safe to assume anything about the localisation.


For date formatting in javascript, see via sig below.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
 
Reply With Quote
 
mt
Guest
Posts: n/a
 
      07-26-2005
"Dr John Stockton" <> wrote in message
news:...

> The default assumption in this newsgroup is that script is for the
> World-Wide Web : note the first two W characters in particular.


Understood. I erred in not pointing out that in my case, I am working on an
Intranet app that will have zero chance of getting viewed by people outside
of my company, which is an American one. It can be debated which format
is best, but my boss is the boss, and he wants the format I mentioned in my
OP. So based on that, I was seeking help, as a person who barely knows
Javascript.


 
Reply With Quote
 
middletree
Guest
Posts: n/a
 
      07-26-2005
Just wanted everyone who's interested to know that I found this:

http://www.softcomplex.com/products/...dar/demo1.html


and it seems to fit the bill. Thanks!


"middletree" <> wrote in message
news:42e516c2$0$11950$ eenews.net...
> Is there a script that will populate, with a click, a textbox with the
> equivalent of the ASP/VBScript Now() function? In ohter words, I'd like it
> to be in this format:
>
> 7/25/2005 10:58:39 AM
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add 1 hour to a time\date stamp (using Now())? Brave ASP General 3 07-25-2009 05:34 PM
issue when populating data in textbox on dropdownlist box selection Dhananjay ASP .Net 1 12-23-2007 03:55 AM
Populating a textbox with selection from a treeview hardieca@hotmail.com ASP .Net 0 07-26-2007 03:22 PM
[Newbie Question] Populating Textbox.text from a dataview using columnnames? DC ASP .Net 0 06-15-2005 02:43 PM
Populating textbox in Formview with a QueryString David Wertz ASP .Net Web Controls 0 08-17-2004 11:31 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57