473,808 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript to get the creation date and time of the file sent and display it in the html page ?

I have just put a internet webcam that save every 30 seconds a picture
via ftp. I have an html file that display this picture file (the name
of the file is always the same and the webcam delete the old file when
save the new one). The problem is: The webcam don't have the option to
put automatically the date and time when the picture as take. How I
can make a simple JavaScript that get the creation date and time of
the file sent by the webcam and display it in the html page ?
Thank you in advance for your help.
If you like to see it the adress is: http://live.imagea.org

Fabrizio
Jul 23 '05 #1
2 6676
"Fabrizio" <fd*@speno.ch > wrote in message
news:db******** *************** ***@posting.goo gle.com...
I have just put a internet webcam that save every 30 seconds a picture
via ftp. I have an html file that display this picture file (the name
of the file is always the same and the webcam delete the old file when
save the new one). The problem is: The webcam don't have the option to
put automatically the date and time when the picture as take. How I
can make a simple JavaScript that get the creation date and time of
the file sent by the webcam and display it in the html page ?
Thank you in advance for your help.
If you like to see it the adress is: http://live.imagea.org

Fabrizio


Will this help? Watch for word-wrap.

This renames "foto.jpg" to "ccyymmddhhnnss _.foto.jpg".

<html>
<head>
<title>foto.htm </title>
<script type="text/javascript">
var dir = "C:\\Temp\\ ";
var pix = "foto.gif";
var fso = new ActiveXObject(" Scripting.FileS ystemObject");
if (fso.FileExists (dir+pix)) {
var now = new Date();
var ymd = now.getFullYear ();
ymd += ((now.getMonth( )+101)+"").subs tr(1,2);
ymd += ((now.getDate() +100)+"").subst r(1,2);
ymd += ((now.getHours( )+100)+"").subs tr(1,2);
ymd += ((now.getMinute s()+100)+"").su bstr(1,2);
ymd += ((now.getSecond s()+100)+"").su bstr(1,2);
var sav = ymd + "_" + pix;
document.write( dir+sav);
fso.MoveFile(di r+pix, dir+sav);
}
</script>
</head>
<body>
</body>
</html>

Note that an ActiveX security warning will be issued.
Jul 23 '05 #2
JRS: In article <E2z8d.335366$F g5.101771@attbi _s53>, dated Tue, 5 Oct
2004 15:26:28, seen in news:comp.lang. javascript, McKirahan
<Ne**@McKirahan .com> posted :
var now = new Date();
var ymd = now.getFullYear ();
ymd += ((now.getMonth( )+101)+"").subs tr(1,2);
ymd += ((now.getDate() +100)+"").subst r(1,2);
ymd += ((now.getHours( )+100)+"").subs tr(1,2);
ymd += ((now.getMinute s()+100)+"").su bstr(1,2);
ymd += ((now.getSecond s()+100)+"").su bstr(1,2);


That looks like a translation of some half-baked code found in a
VBScript newsgroup.

Each line implements a function here often called LZ.

Testing in MSIE4 :
In VBScript, adding 100 and decapitating is the fastest way I know.
In javascript, it is not; my usual way is 40% faster.

with (new Date())
S = ((((getFullYear ()*100 + getMonth()+1)*1 00 + getDate())*100 +
getHours())*100 + getMinutes())*1 00 + getSeconds()

does the same job rather more simply, if S is then used as a string by
concatenation.

However, the job that it does seems only loosely related to what the OP
asked for.

The WebCam continuously updates a file of fixed name, and it is that
name by which it will be fetched. Fabrizio wants to display when that
file was last modified. A search of the newsgroup FAQ for Last,
Modified, or both would have helped. But see sig line 3 below :
it leads to <URL:http://www.merlyn.demo n.co.uk/js-date2.htm#lM>. 2.

ISTM that Fabrizio need only display the lastModified information
discussed there; either the raw string or the string corrected to
international format.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #3

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

Similar topics

3
1722
by: Steve | last post by:
Hi; I'm working on a demo of using a timer on a web site that is made visible by making a div visible. My "PopIn Box" div is empty on the page. Before making it visible I used javascript to get the content from another hidden div. I'm doing it this way to make it easier to add in more messages by simply putting more hidden divs on the page.
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10631
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.