CFLib.org – Common Function Library Project

TurkishDateFormat(givenDate, dateDisplayFormat)

Last updated May 14, 2002

author

Nurettin Omer Hamzaoglu

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Display date in Turkish language and Turkish date format. 8 different outputs available for display.

Return Values:
Returns a string.

Example:

<cfoutput>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),1)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),2)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),3)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),4)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),5)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),6)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),7)#<br>
#TurkishDateFormat(DateFormat(Now(),"dd/mm/yyyy"),8)#
</cfoutput>

Parameters:

Name Description Required
givenDate Date you want to display in Turkish. Yes
dateDisplayFormat Format mask to apply. Yes

Full UDF Source:

/**
 * Display date in Turkish language and Turkish date format.
 * 
 * @param givenDate      Date you want to display in Turkish. (Required)
 * @param dateDisplayFormat      Format mask to apply.   (Required)
 * @return Returns a string. 
 * @author Nurettin Omer Hamzaoglu (omer@hamzaoglu.com) 
 * @version 1, May 14, 2002 
 */
function TurkishDateFormat(GivenDate,DateDisplayFormat){
  var ChangedDate=DateFormat(GivenDate,"mm/dd/yyyy");
  var Ay="";
  var Yil="";
  var Gun = "";
  var DateToDisplay = "";

  if(DateDisplayFormat IS "2" OR DateDisplayFormat IS "4"){
    Gun = ReplaceList(DateFormat(ChangedDate,"ddd"),"Mon,Tue,Wed,Thu,Fri,Sat,Sun","Pazartesi,Sal�,�ar�amba,Per�embe,Cuma,Cumartesi,Pazar");
  }    
  Ay = ReplaceList(DateFormat(ChangedDate,"mm"),"01,02,03,04,05,06,07,08,09,10,11,12","Ocak,�ubat,Mart,Nisan,May�s,Haziran,Temmuz,A�ustos,Eyl�l,Ekim,Kas�m,Aral�k");
  Yil = DateFormat(GivenDate,"yyyy");

  switch(DateDisplayFormat){
    case 1: {
      DateToDisplay = DateFormat(GivenDate,"dd")&"/"&Ay&"/"&Yil;
      break;
    }
    case 2: {
      DateToDisplay = DateFormat(GivenDate,"dd")&"/"&Ay&"/"&Yil&" "&Gun;
      break;
    }
    case 3: {
      DateToDisplay = DateFormat(GivenDate,"dd")&" "&Ay&" "&Yil;
      break;
    }
    case 4: {
      DateToDisplay = DateFormat(GivenDate,"dd")&" "&Ay&" "&Yil&" "&Gun;
      break;
    }
    case 5: {
      DateToDisplay = DateFormat(GivenDate,"dd");
      break;
    }
    case 6: {
      DateToDisplay = Ay;
      break;
    }
    case 7: {
      DateToDisplay = Gun;
      break;
    }
    case 8: {
      DateToDisplay = Yil;
      break;
    }    
  }
  return DateToDisplay;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson