I made this because I wanted to get the date and day of the week individually which GetFullTime() and GetDate() can't seem to get.
function GetDate( Part )
{
Part = Part.tolower();
if( Part == "date" )
{
local Month = GetTok( GetFullTime(), " ", 2 );
local Day = GetTok( GetFullTime(), " ", 3 );
local Year = GetTok( GetFullTime(), " ", 5 );
if( Month == "Jan" ) Month = "January";
if( Month == "Feb" ) Month = "February"
if( Month == "Mar" ) Month = "March"
if( Month == "Apr" ) Month = "April"
if( Month == "May" ) Month = "May"
if( Month == "Jun" ) Month = "June"
if( Month == "Jul" ) Month = "July"
if( Month == "Aug" ) Month = "August"
if( Month == "Sep" ) Month = "September"
if( Month == "Oct" ) Month = "October"
if( Month == "Nov" ) Month = "November"
if( Month == "Dec" ) Month = "December"
return Day + " " + Month + " " + Year;
}
else if( Part == "day" )
{
local Day = GetTok( GetFullTime(), " ", 1 );
if( Day == "Mon" ) Day = "Monday";
if( Day == "Tue" ) Day = "Tuesday"
if( Day == "Wed" ) Day = "Wednesday"
if( Day == "Thu" ) Day = "Thursday"
if( Day == "Fri" ) Day = "Friday"
if( Day == "Sat" ) Day = "Saturday"
if( Day == "Sun" ) Day = "Sunday"
return Day;
}
else if( Part == "time" )
{
local Time = GetTok( GetFullTime(), " ", 4 );
return Time;
}
else return false;
}
Usage:
GetDate("date");
Which returns Day, Month and the Year
For example, 9 March 2017
GetDate("day");
Which returns the day of the week in full form
For example, Thursday
GetDate("time");
Which returns the Hour:Minute:Second
For example, 12:34:56
Note: This might not be the most efficient way to do this but i can't think of any other way so...