Advertisement
Guest User

Habbo Hotel Date Class OLD v0.1

a guest
Jun 20th, 2024
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | Source Code | 0 0
  1. --Date
  2. --Class
  3. --v 0.1
  4.  
  5.  
  6. -- Converts dates to defined format
  7.  
  8.  
  9. --| public:
  10. --|
  11. --| deconstruct
  12. --| define
  13. --| getLocalDateFromStr
  14. --| getLocalDate
  15.  
  16.  
  17. -- General properties:
  18.  
  19. property pDateType
  20. property pDateFormats
  21.  
  22.  
  23. -- Public methods: -- -- -- -- -- -- -- -- -- -- --//
  24.  
  25.  
  26. on construct(me)
  27.  
  28. pDateType = 0
  29. return(TRUE)
  30.  
  31. end
  32.  
  33.  
  34.  
  35. on deconstruct(me)
  36.  
  37. return(TRUE)
  38.  
  39. end
  40.  
  41.  
  42.  
  43. -- Date in integer parameter
  44.  
  45. on define(me, tDateType)
  46.  
  47. pDateType = integer(tDateType)
  48.  
  49. end
  50.  
  51.  
  52.  
  53. -- Date must be in dd.mm.yyyy format \
  54. That is used in server-client messaging! \
  55. Returns the date as a string
  56.  
  57. on getLocalDateFromStr(me, tDateStr, tGivenFormat)
  58.  
  59. if not (stringP(tDateStr)) then return(FALSE)
  60.  
  61. if (voidP(tGivenFormat)) then
  62. -- This is dd.mm.yyyy format, not ISO format with time
  63. -- tGivenFormat =
  64. nothing
  65. else
  66. -- This ISO format with time
  67. tISO = TRUE
  68. end if
  69.  
  70. if (tISO) then
  71.  
  72. else
  73. tItemDelim = the itemDelimiter
  74. the itemDelimiter = "."
  75.  
  76. tLocalDate = me.getLocalDate(tDateStr.item[1],tDateStr.item[2],tDateStr.item[3])
  77.  
  78. the itemDelimiter = tItemDelim
  79. return tLocalDate
  80. end if
  81.  
  82. end
  83.  
  84.  
  85.  
  86. -- Return localized date string \
  87. Required: tDay, tMonth, tYear \
  88. Optional: tHour, tMinute
  89.  
  90. on getLocalDate(me, tDay, tMonth, tYear, tHour, tMinute)
  91.  
  92. -- if (voidP(tDay) OR voidP(tMonth) OR voidP(tYear)) then return(FALSE)
  93. --
  94. -- tDate = pDateFormat
  95. -- tDate = replaceChunks(tDate, "d", integer(tDay))
  96. -- tDate = replaceChunks(tDate, "m", integer(tMonth))
  97. -- tDate = replaceChunks(tDate, "y", integer(tYear))
  98. --
  99. -- tDate = me.getLocalTime(tDate)
  100. --
  101. -- return tDate
  102.  
  103. end
  104.  
  105.  
  106.  
  107.  
  108. ---- PRIVATE
  109.  
  110.  
  111. on getLocalTime(me, tDateTimeStr)
  112.  
  113.  
  114. return tDateTimeStr
  115.  
  116. end
  117.  
  118.  
  119.  
  120.  
  121. on formatDate(me, tTimeArr)
  122.  
  123. -- case pDateFormat of
  124. --
  125. -- 0:
  126. --
  127. -- 1:
  128. --
  129. -- 2:
  130. --
  131.  
  132.  
  133. end
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140. --Date Class OLD
  141. --Antti Kaseva
  142.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement