> LocalTime() at cflib.org
This UDF uses <cffunction>, which I guess is an MX tag. I converted Chad
Jackson's UDF to be compatible with CF5 (in case anyone else wants it).
Note that the offset is for Central Daylight Time (-6).
<!---
Function that returns adjusted local server time.
@return Returns a date object.
@orignal_author chad jackson
@author chris montgomery
@version 1, September 24, 2002
@version 2, November 16, 2003 (CF5)
--->
<cfscript>
function LocalTime()
{
var timeZoneInfo = GetTimeZoneInfo();
// local time GMT offset.
var offset = -6;
var GMTtime = DateAdd('s', timeZoneInfo.UTCtotalOffset, Now() );
var theLocalTime = DateAdd('h',offset,GMTtime);
return theLocaltime;
}
</cfscript>
<p>The date/time on the server is: <cfoutput>#now()#</cfoutput></p>
<p>The local date/time is <cfoutput>#Localtime()#</cfoutput></p>
Cheers.
--
Chris Montgomery
Airtight Web Services http://www.airtightweb.com
Web Development, Web Project Management, Software Sales
210-490-2415
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

