![]() |
Date/Time Script
1 Attachment(s)
Since many people have been asking about this, I figured I'd make something as an example for educational purposes only. This is done in gs2, and must be used serverside online for it to be accurate since timevar2 is different clientside and serverside. The script is commented, but if you have any questions, post here =) enjoy!
|
Quote:
|
I am sure this will be helpful to many :D.
EDIT: A very small correction... The sendtorc line should read: sendtorc(this.hour@":"@this.minute@":"@this.second @" "@this.time@" GMT on "@this.day@", "@this.month@" "@this.date@", "@this.year); In code blocks: NPC Code:sendtorc(this.hour@":"@this.minute@":"@this.second @" "@this.time@" GMT on "@this.day@", "@this.month@" "@this.date@", "@this.year); Quote:
|
Quote:
|
Quote:
Again, nice script :D. |
hehe thank you =)
althought according to lance, the script will be off around 2100, so i guess i'll figure out how gregorian calendars work and implement it in gscript now =D |
Don't worry about it until 2100.
|
Quote:
Quote:
Quote:
|
I havent figured out how the calendar works yet, so bear with me =p
Until then, this is a loose approximation as you said. |
The only way to find the exact date at any time you need to iterate from the beginning date and acrue your date that way.
There isn't any real way to derive the exact date from a bunch of seconds with some simple equation. There will always be some days that your year will not come out right. Note: the way you an I both derive the year in our scripts will produce bad results when nearing the turn of the year on certain years. I know mine will be off at the end quarter of Dec 31 if there is but one leap year between the current date and my subtracted date. I don't really feel like figuring out exactly when yours will be off, but I'll guess that it will be on the first portions of Jan 1 on all non leap years. |
That is true Chad. I imagine a script like that would take a few to execute.
|
| All times are GMT +2. The time now is 09:54 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.