LocalTime()
Last updated September 24, 2002
Version: 1 | Requires: CF6 | Library: DateLib
Description:
This is a function that behaves just like now() for those running sites where server and local time are different. You just have to set your GMT offset and call the function with localtime() to have the local time displayed.
Return Values:
Returns a date object.
Example:
<cfoutput>#lsDateFormat(localtime(), 'full')# #lsTimeFormat(localtime(),'full')#</cfoutput>
Parameters:
No arguments.
Full UDF Source:
<!---
Function that returns adjusted local server time.
@return Returns a date object.
@author chad jackson (chad@textinc.com)
@version 1, September 24, 2002
--->
<cffunction name="LocalTime" returnType="date" output="false" hint="Returns Local Time">
<cfset var timeZoneInfo = GetTimeZoneInfo()>
<!--- local time GMT offset. --->
<cfset var offset = 9>
<cfset var GMTtime = DateAdd('s', timeZoneInfo.UTCtotalOffset, Now() )>
<cfset var theLocalTime = DateAdd('h',offset,GMTtime)>
<cfreturn theLocaltime>
</cffunction>
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