Displaying a correct date and time not of the serv

Results 1 to 3 of 3

Thread: Displaying a correct date and time not of the serv

  1. #1
    Join Date
    Dec 1969

    Default Displaying a correct date and time not of the serv

    How do I display a correct time of my computer not on the server one which is owned by a third party in a different state. I would also like to see my page displaying a accurate time and date viwed anywhere in states?<BR>how can it be done in simplified way?<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Displaying a correct date and time not of the

    You need to set the time using client side code. This code was written with something else in mind, but should do the job...<BR><BR>var dtCDate = new Date()<BR>var sYear = dtCDate.getFullYear()<BR>var sMonth = dtCDate.getMonth() + 1<BR>var sDay = dtCDate.getDate()<BR>var sHours = dtCDate.getHours()<BR>var sMinutes = dtCDate.getMinutes()<BR>var sSeconds = dtCDate.getSeconds()<BR><BR>if (sMonth.toString(10).length == 1) sMonth = &#039;0&#039; + sMonth.toString(10);<BR>if (sDay.toString(10).length == 1) sDay = &#039;0&#039; + sDay.toString(10);<BR><BR>var sFullDate = sYear + &#039;-&#039; + sMonth + &#039;-&#039; + sDay<BR>sFullDate += &#039; &#039; + sHours + &#039;:&#039; + sMinutes + &#039;:&#039; + sSeconds<BR><BR>If you want the time to update rather that just displaying the time when the page loads then you will have to rerun the code above every second. Alternatively you could write code to increment the seconds by one every second then rollover to 0 on passing 59, incrementing the minutes, etc...<BR><BR>Gavin

  3. #3
    Join Date
    Dec 1969

    Default dateadd()

    You need to determine how far from your server you are (time wise) then use the dateadd function to add/subtract hours from the server time...<BR><BR>Response.Write(dateadd("h", 1, time))<BR><BR>-- Whol

Posting Permissions

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