Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Getting time and date on a file name
Old 05-30-2012, 04:09 PM Getting time and date on a file name
Extreme Talker

Posts: 219
Trades: 0
This javascript which I'm using works with a webcam to record a video.

The end result, after the file is recorded generates a file name, as you can see from the code below: Video+video_id.

I recorded a file on April 30th, and the file was named: Video1335806296490.flv. I understand that the time and date in this file name, is the time and day of the recording expressed in seconds.

Would there be an easy line or two of code that I could add so that when I see the file name generated, it would be easier to recognize when the file name is created, as in some type of easy to read month and day and year and time of day?

Any assistance will be greatly appreciated. (Or suggest an alternative tweak to make file names more recognizable?)

Thanks.

Code:
   <script type="text/javascript">
var video_id = get_id();
var filename = get_parm('filename');
if(filename == '' || filename == null)
{
filename = 'Video'+video_id;
}
 
var flashvars = {
filename: filename,
rtmpPath: "rtmp://xxxxxxxxxxxxxxx",
finishURL: "videoplayer.htm?filename="+filename,
};
var params = {
menu: "false",
scale: "noScale",
allowScriptAccess: "always",
bgcolor: "#000000"
};
var attributes = {
id:"webcamrecording"
};
swfobject.embedSWF("recording.swf", "recording", "620", "470", "9", "expressInstall.swf", flashvars, params, attributes);
 
function get_id()
{
var newDate = new Date();
return newDate.getTime();
}
 
function get_parm(name)
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
{
return "";
}
else
{
return results[1];
}
}
 
</script>

Last edited by chrisj; 05-30-2012 at 04:10 PM..
chrisj is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-30-2012, 06:29 PM Re: Getting time and date on a file name
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.w3schools.com/jsref/jsref_getday.asp

http://www.w3schools.com/jsref/jsref_obj_date.asp

http://www.w3schools.com/jsref/jsref_toisostring.asp
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-09-2012, 09:08 PM Re: Getting time and date on a file name
Junior Talker

Posts: 2
Name: Shuaib
Location: Edinburgh, UK
Trades: 0
At the moment looks all automated and autogenerated by the system and JS.

You can try:
------------------------
var vidName = filename

vidName = "VideoA"
------------------------

But this I would be all hardcoded into you file above so every video would be called VideoA!

Unless you have a front end interface too where when a name is typed it is parsed and saved it backend to the JS into an empty var ( eg. var = "..." ) then outputted
to your actual video file eg. videoFile.swf.


Also try asking some guys over at StackOver website, they know too much.
__________________
Application Support Analyst/CEO
---------------------
Ad your link for FREE at
Please login or register to view this content. Registration is FREE
DesignLove is offline
Reply With Quote
View Public Profile
 
Old 06-10-2012, 05:53 AM Re: Getting time and date on a file name
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Also try asking some guys over at StackOver website, they know too much.
Well their answers are of the same "quality" as yours, it really doen't seem worth it!

So explain please; Exactly how DOES hardcoding a filename become the answer to ...
Quote:
suggest an alternative tweak to make file names more recognizable?
???????
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Getting time and date on a file name
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35198 seconds with 11 queries