On Wed, Jan 20, 2010 at 12:29 AM, Tim Selander <[email protected]> wrote:
> Thanks for clearing up the .irev/revlet confusion in my head.
>
> I've read through the thread a couple times... and it seems you CANNOT get
> the user/browser's date and time through RevServer scripts. Correct?
>
> Anyone have a javascript snippet they like to use to get the user's date and
> time? thanks.

As far as I know, the JavaScript Date object gives the browser's date & time.
Here is a routine I have to showing a time stamp:

function showTimeStamp() {
          // show the current date & time in the divider bar
                var date = new Date();
                var m = date.getMinutes();
                var s = date.getSeconds();
                // add a zero in front of numbers < 10
                if (m < 10) { m = "0" + m; }
                if (s < 10) { s = "0" + s; }

                // format into "d/m/yyyy        h:mm:ss"
                var currentDate =       date.getDate() + "/" +
                                                (date.getMonth() + 1) + "/" +
                                                date.getFullYear() + "        " 
+
                                                date.getHours() + ":" + m + ":" 
+ s;

                $('#timestamp').text("Last step: " + currentDate);
}


The last line uses jQuery to display the time stamp in the tag with
the id "timestamp", but you can also use straight JavaScript:
                document.getElementById("timestamp").innerHTML = currentDate;

Note that I have the date formatted in the English/Australian style
(d/m/y), so swap the segments around if you want American dates.

HTH,
Sarah
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to