Neverwinter Vault

Expand AllContract All -Site -My Profile -Features

Neverwinter Nights 2

-NWN2 Files -NWN2 Game Info -NWN2 Resources -NWN2 Community

Neverwinter Nights

-NWN Files -NWN Game Info -NWN Resources -NWN Community

Vault Network
RPG Vault
VN Boards
IGN Vault
Vault Wiki
· Age of Conan
· Anarchy Online
· Asheron's Call
· Dark Age of Camelot
· City of Heroes
· D&D
· EVE Online
· EverQuest
· EverQuest 2
· Final Fantasy
· Guild Wars
· Lineage 2
· Lord of the Rings Online
· Middle Earth
· Neverwinter Nights
· Pirates of the Burning Sea
· Rise of the Argonauts
· Star Wars Galaxies
· Tabula Rasa
· The Matrix Online
· The Witcher
· Titan Quest
· Two Worlds
· Vanguard
· Warhammer
· World of Warcraft

Planet Network
Planet Hub

IGN
Games
Cheats
Entertainment

The Web   The Site  



NWN2 SCRIPTS

- Jump to comments -
Name  Date & Time Functions
Author  WizardStorm Think Group
Submitted / Updated  01-02-2007 / 01-02-2007
Category  Scripting routines
Type  Type - Other
Format  Code Only
Patch  1.00
Description
WizardStorm Think Group is pleased to provide a full compliment of Date & Time functions which are compatible with standard database DateTime strings. Please use and enjoy! Please report any bugs found to: [email protected].

The provided functions are:

//generates YYYY-MM-DD string of current date
string GetCurrentDate();

//generates HH:MM:SS string of current time
string GetCurrentTime();

//generates YYYY-MM-DD HH:MM:SS string of current date and time
string GetCurrentDateTime();

//generates a string YYYY-MM-DD out of given dates
string GetDateString(int nYear, int nMonth, int nDay);

//generates a string HH:MM:SS out of given times
string GetTimeString(int nHour, int nMinute, int nSecond);

//generates a string YYYY-MM-DD HH:MM:SS out of given dates and times
string GetDateTimeString(int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond);

//returns a year, month or day portion of a date as an integer
//usage: nDay = ParseDateString("1977-09-07", "day");
int ParseDateString(string sDateString, string sOption);

//returns a hour, minute or second portion of a time as an integer
//usage: nHour = ParseTimeString("17:03:21", "hour");
int ParseTimeString(string sTimeString, string sOption);

//returns a year, month, day, hour, minute or second portion of a DateTime as an integer
//usage: nHour = ParseDateTimeString("1977-09-07 17:03:21", "hour");
int ParseDateTimeString(string sDateTimeString, string sOption);

//usage: iNumOfDaysElapsed = GetDateDifference("1352-1-14", "1977-7-9", "days");
//uses NWN calendar settings for # of days in month (28)
//values for sOption are: years, months, days
//note: sDate1 MUST BE <= SDate2
//i.e. GetDateDifference("1356-01-14", "1355-01-14", "months") will return -1
int GetDateDifference(string sDate1, string sDate2, string sOption);

//usage: iNumOfMinutesElapsed = GetTimeDifference("06:14:22", "14:49:31", "minutes");
//uses NWN calendar settings for # of hours in day (0-23)
//values for sOption are: hours, minutes, seconds
//note: sTime1 MUST BE <= STime2
//i.e. GetTimeDifference("16:14:22", "14:49:31", "minutes") will return -1
int GetTimeDifference(string sTime1, string sTime2, string sOption);

//usage: sDueDate = GetFutureDate(GetCurrentDate(), 7, 1, 0);
//this will return a string 7 days and 1 month in the future
string GetFutureDate(string sStartDate, int nIncYear = 0, int nIncMonth = 0, int nIncDay = 0);

//usage: sBDay = GetPastDate(GetCurrentDate(), 0, 0, 50);
//this will return a string 50 years in the past
string GetPastDate(string sStartDate, int nIncYear = 0, int nIncMonth = 0, int nIncDay = 0);

//purpose: test if sDate1 == sDate2
int CompareDates(string sDate1, string sDate2);

//Converts sDateTime to Seconds
int DateTimeToSeconds(string sDateTime);

Files

NameTypeSizeDownloads
wstg_date_time_functions.erfwstg_date_time_functions.erf
Submitted: 01-02-2007 / Last Updated: 01-02-2007
erf28.84Kb311
This ERF contains a single file containing the 15 DateTime functions.
SCORE OUT OF 10
9.7
7 votes
View Stats
Cast Your Vote!
Voting FAQ

PORTFOLIO
Add this entry to your portfolio so you can track it
Manage your existing portfolios or create a new one.
SCREENS
No Images




You Must Be Logged In to Participate.
Comments (11):

Posted by +scarface+ at 2009-03-24 13:35:50    
I found a bug in your GetTimeDifference() function.

This part here:

nTempHour1 = ParseDateString(sTime1, "hour");
nTempMinute1 = ParseDateString(sTime1, "minute");
nTempSecond1 = ParseDateString(sTime1, "second");
nTempHour2 = ParseDateString(sTime2, "hour");
nTempMinute2 = ParseDateString(sTime2, "minute");
nTempSecond2 = ParseDateString(sTime2, "second");

Should be:

nTempHour1 = ParseTimeString(sTime1, "hour");
nTempMinute1 = ParseTimeString(sTime1, "minute");
nTempSecond1 = ParseTimeString(sTime1, "second");
nTempHour2 = ParseTimeString(sTime2, "hour");
nTempMinute2 = ParseTimeString(sTime2, "minute");
nTempSecond2 = ParseTimeString(sTime2, "second");
_________________________
§çà®Fãçë�

NWN1 Submissions:
[Persistent Banking] - [Character Appearance Modifier]
[XP/GP Distribution] - [Item Crafting] - [Socketed Items]

NWN2 Submissions:
[Persistent Banking]

Posted by Inder at 2008-12-28 07:48:29    Voted 9.00 on 12/28/08
Fantastic work! Made my mod do-able without ripping my hair out creating complicated scripts. Great work!

Posted by Caos81 at 2007-10-25 15:47:39    Voted 9.75 on 10/25/07
I've got my own "time" libraries but some of this funtions are very handy and usefull. Thanks!
_________________________
DM Client Extension for NwN2- Inventory & Variables Manager
xSoH - eXtended Sleight of Hand System
DragonLance Italia NwN2 Italian Shard
NwN2xLauncher

Posted by Urlord at 2007-07-22 14:56:02    Voted 9.75 on 01/02/07
Tegashi - it uses the game Date & Time.

If you want to pull server date and time, I recommend you look into NWNX4.
_________________________
Peace,

Jim
AKA Urlord

Visit the Persistent World of Nymri

Posted by Tegashi at 2007-07-13 11:38:48    
I have a question. Do these functions pull Module Date and Time or actual Server (Real-time)?

Posted by NorD_fr at 2007-05-24 11:11:31    Voted 9.00 on 05/24/07
Excellent library.
_________________________
Québec!

Posted by Reisiger at 2007-01-30 08:55:10    Voted 10.00 on 01/30/07
Exactely what I've been looking for :-)

Posted by puket at 2007-01-15 11:22:55    Voted 10.00 on 01/15/07
very useful,no function is missing so far to work with the time in a mod.A 10 is is ok.

Posted by cricket at 2007-01-03 11:08:20    Voted 10.00 on 01/03/07
I have found these very useful!
Thx!

Posted by Urlord at 2007-01-02 23:11:45    Voted 9.75 on 01/02/07
If you like what you see with this set of Date & Time functions, please vote and/or comment. If you can think of anything that was left out or would be better another way, let us know. Our goal is to produce nothing but the very best.

Thanks,
_________________________
Peace,

Jim
AKA Urlord

Visit the Persistent World of Nymri

Posted by Urlord at 2007-01-02 15:32:43    Voted 9.75 on 01/02/07
I believe there is always room for improvement.
_________________________
Peace,

Jim
AKA Urlord

Visit the Persistent World of Nymri

You must be Logged In to post comments in this section.

10 - A Masterpiece, Genuinely Groundbreaking
9 - Outstanding, a Must Have
8 - Excellent, Recommended to Anyone
7 - Very Good, Deserves a Look
6 - Good, Qualified Recommendation
5 - Fair, Solid yet Unremarkable
4 - Some Merit, Requires Improvements
3 - Poor Execution, Potential Unrealized
2 - Very Little Appeal
1 - Not Recommended to Anyone

 
Most recent posts on the MMO General Boards
Analyst: Star Wars: The Old Republic Could...Analyst: Star Wars: The Old Republic Could Sell 3M: more numbers
- last reply by Acao on Aug 15, 2011 06:15 PM
which class will your first character be
- last reply by Blisteringballs on Aug 15, 2011 05:50 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 05:00 PM
New Community Content!
- posted by Vault_News on Aug 15, 2011 04:00 PM
NWN Idea Database Update
- posted by Vault_News on Aug 15, 2011 03:46 PM
Missing Votes for NWN2 Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:40 PM
Missing Votes for NWN Hall of Fame
- posted by Vault_News on Aug 15, 2011 03:39 PM
Random Questions and game altering suggest...Random Questions and game altering suggestions!!!
- last reply by ArkadyTepes on Aug 15, 2011 03:22 PM
State of the game?
- last reply by LyricOpera on Aug 15, 2011 01:37 PM
Yesterday streaming, now demanding downloa...Yesterday streaming, now demanding download :(
- last reply by Sinane-tk on Aug 15, 2011 10:23 AM
 

   


IGN Entertainment
By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the User Agreement.
Copyright 1996-2011, IGN Entertainment, Inc. | Support | Privacy Policy | User Agreement | RSS Feeds
IGN’s enterprise databases running Oracle, SQL and MySQL are professionally monitored and managed by Pythian Remote DBA.


NWN2 Hall of Fame

HOF NWN2 Prefab Areas


View all Hall of Fame entries


Neverwinter Nights 2

TOP NWN2 Modules

NEW Modules

NEW Reviews

NEW INTL. Modules

TOP Hakpaks

TOP Gameworlds

TOP Tutorials

TOP Prefab:Areas

TOP Blueprints

TOP Plugins

TOP UI

TOP Other

TOP Visual Effects

TOP Scripts

TOP Tools

TOP Movies

TOP Models

TOP Characters





Hall of Fame

HOF NWN Modules


View all Hall of Fame entries


TOP NWN Modules

NEW NWN Modules

NEW Reviews

TOP Intl. Modules

TOP NWN Hakpaks

TOP NWN Gameworlds

TOP NWN Models

TOP NWN Portraits

TOP NWN Scripts

TOP NWN Prefabs

TOP NWN Other

TOP NWN Movies

TOP Sounds

TOP NWN Textures

TOP NWN Creatures

TOP NWN Characters