/    Sign up×
Community /Pin to ProfileBookmark

Non-programmer needs help adjusting script

I am using this script to display the date on a moon rise/moon set display. It works fine for our pages for the U.S. site, but needs to be 14 hour to the + side for our Western Australia site. Can someone tell me how I can turn this ahead 14 hours?

[code]
<script language=”JavaScript”><!–
function makeArray() { for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments[i]; }
var months = new makeArray(‘January’,’February’,’March’,
‘April’,’May’,’June’,’July’,’August’,’September’,
‘October’,’November’,’December’);
var date = new Date();
var day = date.getDate() + 1;
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
document.write(months[month] + ” ” + day + “, ” + year);
//–></script>
[/code]

Thanks for your time.
richardnk

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@scragarJan 29.2008 — [code=php]function makeArray() { for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments[i]; }
var months = new makeArray('January','February','March',
'April','May','June','July','August','September',
'October','November','December');
var date = new Date();

date.setHours(date.getHours()+14);// change adjusement if needed.

var day = date.getDate() + 1;
var month = date.getMonth() + 1;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
document.write(months[month] + " " + day + ", " + year);[/code]
Copy linkTweet thisAlerts:
@KorJan 29.2008 — use [B]type[/B]; language is obsolete and it might bring errors in modern browsers:

<script [COLOR="Blue"]type="text/javascript"[/COLOR]>
Copy linkTweet thisAlerts:
@richardnkauthorJan 29.2008 — Thanks gentlemen,

I will make the changes and have it on the site tonight. Time differences being what they are, I won't know the results until 10 am tomorrow morning.

richardk
Copy linkTweet thisAlerts:
@JMRKERJan 30.2008 — Only to simplify and show results: ?
[code=php]
<script type="text/javascript">
var months = new Array ('January','February','March','April','May','June',
'July','August','September','October','November','December');

var date = new Date();
date.setHours(date.getHours()+14);// change adjusement if needed.
var day = date.getDate();
var month = date.getMonth();
var year = date.getFullYear();
document.write('Then: '+months[month] + " " + day + ", " + year);

date = new Date();
date.setHours(date.getHours());// change adjusement if needed.
day = date.getDate();
month = date.getMonth();
year = date.getFullYear();
document.write('<br />Now: '+months[month] + " " + day + ", " + year);
</script>
[/code]


Note: For testing purposes, you can also set your computer clock to tomorrow and return it to correct time when finished.
Copy linkTweet thisAlerts:
@richardnkauthorJan 31.2008 — Thank you guys for your help.

Everything is working fine.

Thanks again,

Richard
×

Success!

Help @richardnk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...