473,385 Members | 1,325 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,385 software developers and data experts.

Now -- populating textbox with date/time stamp

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

Jul 25 '05 #1
5 7668


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/
Jul 25 '05 #3
JRS: In article <42***********************@authen.white.readfreene ws.ne
t>, dated Mon, 25 Jul 2005 11:43:11, seen in news:comp.lang.javascript,
middletree <mi********@verywarmmail.com> 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.
Jul 25 '05 #4
mt
"Dr John Stockton" <jr*@merlyn.demon.co.uk> wrote in message
news:YM**************@merlyn.demon.co.uk...
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.
Jul 26 '05 #5
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" <mi********@verywarmmail.com> wrote in message
news:42***********************@authen.white.readfr 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

Jul 26 '05 #6

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

Similar topics

5
by: akoper | last post by:
I have a table that is a project. Each record is a task in the project. One field in each record is a date/time stamp for when that task was completed. I need to be able to: 1) compute how much...
7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
6
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital...
5
by: Des | last post by:
I have to do an events calender for a church. The events display will be limited to that week. If someone went in today Wed 24th I want to display 21st to 27th. I dont want any code samples, just...
1
by: Susan Bricker | last post by:
Greetings. I have a report (actually all of my reports in an MDB) that I want to date/time stamp at the bottom. Previously, I had used the builtin function of Now(). I thought that would give...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
1
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a...
16
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.