Results 1 to 2 of 2

Thread: Getting time and date on a file name

Hybrid View

  1. #1
    Join Date
    Feb 2005

    Getting time and date on a file name

    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 today April 30th, and the file was named: Video1335806296490.flv. I don't understand where the time and date are in this file name, and I don't understand why all the recorded files begin with 1335. Can you shed some light here?

    (Or suggest an alternative tweak to make file names more recognizable?)


    <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 = {
    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 "";
    return results[1];

  2. #2
    Join Date
    Nov 2007
    The numbers are the number of milliseconds since January 1, 1970.

    var d = new Date(1335806296490);
    If you want friendly names, play around with the Date related functions (or Google example) for creating a "YYYY-MM-DD-HH-MM-SS" type name from getTime().

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center

Recent Articles