vForums Support :: Programming & Coding :: Code Requests & Support :: [F] Need help with code - View Topic
 |  |
| Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | [F] Need help with code (21st Feb 08 at 7:26pm UTC) | | I need help with this code, it is in 24 hours and I want it to be in 12
 Code: - <SCRIPT LANGUAGE = "JavaScript">
- <!-- Begin Script
-
- //Display Time of last visit script
-
-
- var expDays = 30;
- var exp = new Date();
- exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
-
- function When(info){
- // When
- var rightNow = new Date()
- var WWHTime = 0;
- WWHTime = GetCookie('WWhenH')
-
- WWHTime = WWHTime * 1
-
- var lastHereFormatting = new Date(WWHTime); // Date-i-fy that number
- var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
- var lastHereInDateFormat = "" + lastHereFormatting; // Gotta use substring functions
- var dayOfWeek = lastHereInDateFormat.substring(0,3)
- var dateMonth = lastHereInDateFormat.substring(4,10)
- var hours = "" + lastHereFormatting.getHours()
- var year = lastHereFormatting.getYear()
- if (year < 1000) year+=1900
- var minutes = "" + lastHereFormatting.getMinutes()
- if (minutes.substring(0,1) == minutes){
- minutes = "0" + minutes
- }
- var WWHText = dayOfWeek + ", " + dateMonth + " " + year + " at " + hours + ":" + minutes// display
-
- SetCookie ("WWhenH", rightNow.getTime(), exp)
-
- return WWHText;
- }
-
- function Count(info){
- var psj=0;
- // How many times
- var WWHCount = GetCookie('WWHCount')
- if (WWHCount == null) {
- WWHCount = 0;
- }
- else{
- WWHCount++;
- }
- SetCookie ('WWHCount', WWHCount, exp);
-
-
- return WWHCount+1;
- }
-
-
-
- function set(){
- // VisitorName = prompt("Who are you?", "Nada");
- // SetCookie ('VisitorName', VisitorName, exp);
- SetCookie ('WWHCount', 0, exp);
- SetCookie ('WWhenH', 0, exp);
- }
-
- function getCookieVal (offset) {
- var endstr = document.cookie.indexOf (";", offset);
- if (endstr == -1)
- endstr = document.cookie.length;
- return unescape(document.cookie.substring(offset, endstr));
- }
-
- function GetCookie (name) {
- var arg = name + "=";
- var alen = arg.length;
- var clen = document.cookie.length;
- var i = 0;
- while (i < clen) {
- var j = i + alen;
- if (document.cookie.substring(i, j) == arg)
- return getCookieVal (j);
- i = document.cookie.indexOf(" ", i) + 1;
- if (i == 0) break;
- }
- return null;
- }
-
- function SetCookie (name, value) {
- var argv = SetCookie.arguments;
- var argc = SetCookie.arguments.length;
- var expires = (argc > 2) ? argv[2] : null;
- var path = (argc > 3) ? argv[3] : null;
- var domain = (argc > 4) ? argv[4] : null;
- var secure = (argc > 5) ? argv[5] : false;
- document.cookie = name + "=" + escape (value) +
- ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
- ((path == null) ? "" : ("; path=" + path)) +
- ((domain == null) ? "" : ("; domain=" + domain)) +
- ((secure == true) ? "; secure" : "");
- }
-
- function DeleteCookie (name) {
- var exp = new Date();
- exp.setTime (exp.getTime() - 1);
- // This cookie is history
- var cval = GetCookie (name);
- document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
-
- }
- // End Script -->
- </SCRIPT>
- <center><script>
- if (Count()==1){
- document.write("This is your 1st visit to our page")
- When()
- }
- else if (Count()>1)
- document.write("Welcome back. Your last visit was on <b>" + When() +"</B>.")
- </script></center>
- <div align='center'>
- <font face='Courier New'>
- <span id='hours'>--</span><span id='tick'>-<span id='minutes'>--</span><span id='stat'>-</span>
- </font>
- </div>]
Thanks, Darkmage | |
| Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Need help with code (21st Feb 08 at 7:34pm UTC) | | Who coded that? | |
| Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Need help with code (21st Feb 08 at 8:28pm UTC) | | I don't know Ive had that for 3 years now, I found it off a website, that was dead, and decided to use it.
I don't understand one bit of it, and I can't find the (24) part so I can't change it to 12. | |
| Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Need help with code (23rd Feb 08 at 11:34pm UTC) | | bump | |
| Paddy Full Member
   Insane Clown
![[Avatar]](http://lh6.ggpht.com/__wnO9rF92-g/Su8WGep1jPI/AAAAAAAAFmU/REVHI_iTylg/Mr_Charming.jpg) Posts: 288 Status: Offline Gender: Male Location: Buffalo, New York Age: 35 Joined:
pmwwwskypeaimgtalk | Re: Need help with code (24th Feb 08 at 3:39am UTC) | |  Code: - <SCRIPT LANGUAGE = "JavaScript">
- <!-- Begin Script
-
- //Display Time of last visit script
-
-
- var expDays = 30;
- var exp = new Date();
- exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
-
- function When(info){
- // When
- var rightNow = new Date()
- var WWHTime = 0;
- WWHTime = GetCookie('WWhenH')
-
- WWHTime = WWHTime * 1
-
- var lastHereFormatting = new Date(WWHTime); // Date-i-fy that number
- var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
- var lastHereInDateFormat = "" + lastHereFormatting; // Gotta use substring functions
- var dayOfWeek = lastHereInDateFormat.substring(0,3)
- var dateMonth = lastHereInDateFormat.substring(4,10)
- var hours = lastHereFormatting.getHours()
- if(hours > 12){
- hours = hours - 12 + " pm"
- }else{
- hours = hours + " am"
- }
- hours = "" + hours
- var year = lastHereFormatting.getYear()
- if (year < 1000) year+=1900
- var minutes = "" + lastHereFormatting.getMinutes()
- if (minutes.substring(0,1) == minutes){
- minutes = "0" + minutes
- }
- var WWHText = dayOfWeek + ", " + dateMonth + " " + year + " at " + hours + ":" + minutes// display
-
- SetCookie ("WWhenH", rightNow.getTime(), exp)
-
- return WWHText;
- }
-
- function Count(info){
- var psj=0;
- // How many times
- var WWHCount = GetCookie('WWHCount')
- if (WWHCount == null) {
- WWHCount = 0;
- }
- else{
- WWHCount++;
- }
- SetCookie ('WWHCount', WWHCount, exp);
-
-
- return WWHCount+1;
- }
-
-
-
- function set(){
- // VisitorName = prompt("Who are you?", "Nada");
- // SetCookie ('VisitorName', VisitorName, exp);
- SetCookie ('WWHCount', 0, exp);
- SetCookie ('WWhenH', 0, exp);
- }
-
- function getCookieVal (offset) {
- var endstr = document.cookie.indexOf (";", offset);
- if (endstr == -1)
- endstr = document.cookie.length;
- return unescape(document.cookie.substring(offset, endstr));
- }
-
- function GetCookie (name) {
- var arg = name + "=";
- var alen = arg.length;
- var clen = document.cookie.length;
- var i = 0;
- while (i < clen) {
- var j = i + alen;
- if (document.cookie.substring(i, j) == arg)
- return getCookieVal (j);
- i = document.cookie.indexOf(" ", i) + 1;
- if (i == 0) break;
- }
- return null;
- }
-
- function SetCookie (name, value) {
- var argv = SetCookie.arguments;
- var argc = SetCookie.arguments.length;
- var expires = (argc > 2) ? argv[2] : null;
- var path = (argc > 3) ? argv[3] : null;
- var domain = (argc > 4) ? argv[4] : null;
- var secure = (argc > 5) ? argv[5] : false;
- document.cookie = name + "=" + escape (value) +
- ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
- ((path == null) ? "" : ("; path=" + path)) +
- ((domain == null) ? "" : ("; domain=" + domain)) +
- ((secure == true) ? "; secure" : "");
- }
-
- function DeleteCookie (name) {
- var exp = new Date();
- exp.setTime (exp.getTime() - 1);
- // This cookie is history
- var cval = GetCookie (name);
- document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
-
- }
- // End Script -->
- </SCRIPT>
- <center><script>
- if (Count()==1){
- document.write("This is your 1st visit to our page")
- When()
- }
- else if (Count()>1)
- document.write("Welcome back. Your last visit was on <b>" + When() +"</B>.")
- </script></center>
- <div align='center'>
- <font face='Courier New'>
- <span id='hours'>--</span><span id='tick'>-<span id='minutes'>--</span><span id='stat'>-</span>
- </font>
- </div>]
-
Try that?
~Artemis | |
| Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Need help with code (24th Feb 08 at 3:48am UTC) | | This is what comes out: Welcome back. Your last visit was on Sat, Feb 23 2008 at 9 pm:47.
| |
| Paddy Full Member
   Insane Clown
![[Avatar]](http://lh6.ggpht.com/__wnO9rF92-g/Su8WGep1jPI/AAAAAAAAFmU/REVHI_iTylg/Mr_Charming.jpg) Posts: 288 Status: Offline Gender: Male Location: Buffalo, New York Age: 35 Joined:
pmwwwskypeaimgtalk | Re: Need help with code (24th Feb 08 at 4:51am UTC) | | oh, hang on...
 Code: - <SCRIPT LANGUAGE = "JavaScript">
- <!-- Begin Script
-
- //Display Time of last visit script
-
-
- var expDays = 30;
- var exp = new Date();
- exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
-
- function When(info){
- // When
- var rightNow = new Date()
- var WWHTime = 0;
- WWHTime = GetCookie('WWhenH')
-
- WWHTime = WWHTime * 1
-
- var lastHereFormatting = new Date(WWHTime); // Date-i-fy that number
- var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
- var lastHereInDateFormat = "" + lastHereFormatting; // Gotta use substring functions
- var dayOfWeek = lastHereInDateFormat.substring(0,3)
- var dateMonth = lastHereInDateFormat.substring(4,10)
- var hours = lastHereFormatting.getHours()
- var meridian = 'am'
- if(hours > 12){
- hours = hours - 12
- meridian = 'pm'
- }else{
- hours = hours
- }
- hours = "" + hours
- var year = lastHereFormatting.getYear()
- if (year < 1000) year+=1900
- var minutes = "" + lastHereFormatting.getMinutes()
- if (minutes.substring(0,1) == minutes){
- minutes = "0" + minutes
- }
- var WWHText = dayOfWeek + ", " + dateMonth + " " + year + " at " + hours + ":" + minutes + ' ' + meridian// display
-
- SetCookie ("WWhenH", rightNow.getTime(), exp)
-
- return WWHText;
- }
-
- function Count(info){
- var psj=0;
- // How many times
- var WWHCount = GetCookie('WWHCount')
- if (WWHCount == null) {
- WWHCount = 0;
- }
- else{
- WWHCount++;
- }
- SetCookie ('WWHCount', WWHCount, exp);
-
-
- return WWHCount+1;
- }
-
-
-
- function set(){
- // VisitorName = prompt("Who are you?", "Nada");
- // SetCookie ('VisitorName', VisitorName, exp);
- SetCookie ('WWHCount', 0, exp);
- SetCookie ('WWhenH', 0, exp);
- }
-
- function getCookieVal (offset) {
- var endstr = document.cookie.indexOf (";", offset);
- if (endstr == -1)
- endstr = document.cookie.length;
- return unescape(document.cookie.substring(offset, endstr));
- }
-
- function GetCookie (name) {
- var arg = name + "=";
- var alen = arg.length;
- var clen = document.cookie.length;
- var i = 0;
- while (i < clen) {
- var j = i + alen;
- if (document.cookie.substring(i, j) == arg)
- return getCookieVal (j);
- i = document.cookie.indexOf(" ", i) + 1;
- if (i == 0) break;
- }
- return null;
- }
-
- function SetCookie (name, value) {
- var argv = SetCookie.arguments;
- var argc = SetCookie.arguments.length;
- var expires = (argc > 2) ? argv[2] : null;
- var path = (argc > 3) ? argv[3] : null;
- var domain = (argc > 4) ? argv[4] : null;
- var secure = (argc > 5) ? argv[5] : false;
- document.cookie = name + "=" + escape (value) +
- ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
- ((path == null) ? "" : ("; path=" + path)) +
- ((domain == null) ? "" : ("; domain=" + domain)) +
- ((secure == true) ? "; secure" : "");
- }
-
- function DeleteCookie (name) {
- var exp = new Date();
- exp.setTime (exp.getTime() - 1);
- // This cookie is history
- var cval = GetCookie (name);
- document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
-
- }
- // End Script -->
- </SCRIPT>
- <center><script>
- if (Count()==1){
- document.write("This is your 1st visit to our page")
- When()
- }
- else if (Count()>1)
- document.write("Welcome back. Your last visit was on <b>" + When() +"</B>.")
- </script></center>
- <div align='center'>
- <font face='Courier New'>
- <span id='hours'>--</span><span id='tick'>-<span id='minutes'>--</span><span id='stat'>-</span>
- </font>
- </div>]
That'll fix you up.
~Artemis | |
| Nick Very Senior Member
    
![[Avatar]](http://uploads.vforums.co.uk/forums/support/f_5e7b1402b305d883af97446b2fedc6c2_1-eog.jpeg) Posts: 3,013 Status: Offline Gender: Male Location: vForums Age: 35 Joined:
pmwww | Re: Need help with code (24th Feb 08 at 10:23pm UTC) | | Thanks it works ^_^ | |
| Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Need help with code (24th Feb 08 at 10:36pm UTC) | | Thanks Arty! | |
| |
 |  |
|