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;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson