Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
ADO Xtra For MUS
Lingo Library
Can't change field value - Valentina
Noise Algorithm - Imaging Lingo
Digital Clock Puzzle
SQLite Xtra
Glu32
Import text as cast members
List of Globals
Spam and Faoul language filter for shockwave
MediaMacros Xtras Mall
 

 

 

Behavior getNameOfDate

Added on 5/14/2002

 

Compatibilities:
D7 D8 D8_5 Script Shockwave

This item has not yet been rated

Author: mango

returns the name of day or month in chosen language

--usage getNameOfDate
--returns the name of day or month in chosen language

--getDate(theDate, request, language, abb)
--theDate, required. Must be of type date and must be of after date(1900,01,01)
--request, required. Must be either #day or #month (symbol)
--language, optional. Should be a string. Add your own in the case statement within the handler
--Language will default to English
--abb, optional. Makes the returned string to be of three chars length

--errorcodes
-- -1 = request is not of type #symbol.
-- -2 = theDate is not of type #date
-- -3 = theDate is pre 1900
-- -4 = request values is other than #day and #month

--example:
--put getNameOfDate(the systemdate,#day,"se")
-- "Onsdag"
--put getNameOfDate(the systemdate,#month)
-- "May"
--put "You were born on a" && getnameofdate(date(1992,07,13),#day)
-- "You were born on a Monday"

on getNameOfDate theDate, request, language, abb
  if symbolP(request) then
    if ilk(theDate) = #date then
      if not (ilk(abb) = #integer or ilk(abb) = #void) then abb = 0
      case language of
        "se":
          days = ["Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag", "Söndag"]
          months = ["Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"]          
        otherwise
          days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
          months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]          
      end case
      tDate = [:]
      refDate=date(1900,1,1)
      if theDate - refDate < 0 then return -3
      currentDayNum = ((theDate - refDate) mod 7) +1
      currentDay = days[currentDayNum]
      if abb then currentDay = currentDay.char[1..3]
      tDate.addProp(#day, currentDay)
      currentMonth = months[theDate.month]
      if abb then currentMonth = currentMonth.char[1..3]
      tDate.addProp(#month, currentMonth)
      if voidp(tdate[request]) then return -4
      return tDate[request]
    else
      return -2
    end if
  else
    return -1
  end if
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail