Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Date
- --Class
- --v 0.1
- -- Converts dates to defined format
- --| public:
- --|
- --| deconstruct
- --| define
- --| getLocalDateFromStr
- --| getLocalDate
- -- General properties:
- property pDateType
- property pDateFormats
- -- Public methods: -- -- -- -- -- -- -- -- -- -- --//
- on construct(me)
- pDateType = 0
- return(TRUE)
- end
- on deconstruct(me)
- return(TRUE)
- end
- -- Date in integer parameter
- on define(me, tDateType)
- pDateType = integer(tDateType)
- end
- -- Date must be in dd.mm.yyyy format \
- That is used in server-client messaging! \
- Returns the date as a string
- on getLocalDateFromStr(me, tDateStr, tGivenFormat)
- if not (stringP(tDateStr)) then return(FALSE)
- if (voidP(tGivenFormat)) then
- -- This is dd.mm.yyyy format, not ISO format with time
- -- tGivenFormat =
- nothing
- else
- -- This ISO format with time
- tISO = TRUE
- end if
- if (tISO) then
- else
- tItemDelim = the itemDelimiter
- the itemDelimiter = "."
- tLocalDate = me.getLocalDate(tDateStr.item[1],tDateStr.item[2],tDateStr.item[3])
- the itemDelimiter = tItemDelim
- return tLocalDate
- end if
- end
- -- Return localized date string \
- Required: tDay, tMonth, tYear \
- Optional: tHour, tMinute
- on getLocalDate(me, tDay, tMonth, tYear, tHour, tMinute)
- -- if (voidP(tDay) OR voidP(tMonth) OR voidP(tYear)) then return(FALSE)
- --
- -- tDate = pDateFormat
- -- tDate = replaceChunks(tDate, "d", integer(tDay))
- -- tDate = replaceChunks(tDate, "m", integer(tMonth))
- -- tDate = replaceChunks(tDate, "y", integer(tYear))
- --
- -- tDate = me.getLocalTime(tDate)
- --
- -- return tDate
- end
- ---- PRIVATE
- on getLocalTime(me, tDateTimeStr)
- return tDateTimeStr
- end
- on formatDate(me, tTimeArr)
- -- case pDateFormat of
- --
- -- 0:
- --
- -- 1:
- --
- -- 2:
- --
- end
- --Date Class OLD
- --Antti Kaseva
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement