Advertisement
_Sk_

Some Time Functions

Mar 13th, 2015
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. *****************************************(Some Time Functions)************************************************
  2. Created By Sk.
  3. function GetTime(a = time())
  4. {
  5. local b = date(a),hour = b.hour,mint = b.min,sec = b.sec;
  6. return format("%02d:%02d:%02d",hour,mint,sec);
  7. }
  8. function GetDate(a = time())
  9. {
  10. local b = date(a),day = b.day,month = b.month+1,year = b.year;
  11. return format("%02d-%02d-%i",day,month,year);
  12. }
  13. function GetFullTime(a = time())
  14. {
  15. local b = date(a),wday = b.wday,month = b.month,day = b.day,year = b.year;
  16. local function Week(d)
  17. {
  18.     switch(d)
  19.     {
  20.         case 0: return "Sunday";
  21.         case 1: return "Monday";
  22.         case 2: return "Tuesday";
  23.         case 3: return "Wednesday";
  24.         case 4: return "Thursday";
  25.         case 5: return "Friday";
  26.         case 6: return "Saturday";
  27.     }
  28. };
  29. local function Month(d)
  30. {
  31.     switch(d)
  32.     {
  33.         case 1: return "January";
  34.         case 2: return "February";
  35.         case 3: return "March";
  36.         case 4: return "April";
  37.         case 5: return "May";
  38.         case 6: return "June";
  39.         case 7: return "July";
  40.         case 8: return "August";
  41.         case 9: return "September";
  42.         case 10: return "October";
  43.         case 11: return "November";
  44.         case 12: return "December";
  45.     }
  46. };
  47. //return format("%.3s %.3s %02d %s %i",Week(wday),Month(month+1),day,GetTime(a),year) // in 0.3
  48. return format("%s, %s %02d, %i, %s",Week(wday),Month(month+1),day,year,GetTime(a)); // in 0.4
  49. }
  50. Hope you like them.
  51. Credits [VU_T]Sk aka Sk.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement