Daylight savings time doesn't correct with system clock, fix?

Daylight savings time came this weeekend, and I noticed when I do a timestamp in debian I get

:~# date
Mon Mar 12 10:49:49 CDT 2018

Yet a time in lucee didn’t change with the system:
“Monday, March 12th, 2018 9:51:40 AM”

I have narrowed the problem down to this function. i use eopoch time,

<cffunction name="epochTime" output="false" access="public" returnType="string">
    <cfargument name="mydatetime"  type="date"  required="false" default="" />
		<cfscript>
			// set the base time from when epoch time starts
			startDate = createdatetime( '1970','01','01','00','00','00' );			
			datetimeNow = dateConvert( "local2Utc", mydatetime );
			return datediff( 's', startdate, datetimeNow );
		</cfscript>
</cffunction>

this line:

datetimeNow = dateConvert( "local2Utc", mydatetime );

returns time 1 hour off. Looking for a fix. If you know one, please let me know. Thanks

Restart the service Lucee is running on and see if that fixes it.

additionally, i would do a

apt-get update 
apt-get upgrade

Sometimes the packages are buggy and fixed within a few hours or days on debian.

thank you for the suggestion, I did try the apt-gets but it didn’t change anything…

I don’t know why the time is off when using, dateConvert( “local2Utc”, mydatetime );
Yet if I do a #now()# in lucee I get he right time.

My fix for now is to just add an hour to the current time before doing the date convert. But I think this is weird, and would love to know how to fix it right. As someday if the date convert function works correctly then its a problem again.

        cfTZ = getTimeZoneInfo(); 
            dateObj = mydatetime; 
            if (cfTZ.isDSTOn) { 
                mydatetime = dateAdd('h', 1, mydatetime); 
            }
<cffunction name="epochTime" output="false" access="public" returnType="string">
    <cfargument name="mydatetime"  type="date"  required="false" default="" />
		<cfscript>
			// set the base time from when epoch time starts
            startDate = createdatetime( '1970','01','01','00','00','00' );	
            
            cfTZ = getTimeZoneInfo(); 
            dateObj = mydatetime; 
            if (cfTZ.isDSTOn) { 
                mydatetime = dateAdd('h', 1, mydatetime); 
            } 
    
			datetimeNow = dateConvert( "local2Utc", mydatetime );
			return datediff( 's', startdate, datetimeNow );
		</cfscript>
</cffunction>

The issue with UTC is that not all locations use DST.

If the time is correct on the server, you could use the NOW Function, which is suppose to get the date time form the server.

Just replace

cftz = gettiezoneinfo(); 

to

cftz = Now();

If I remember, doesn’t Java have it’s own timezone info? What java version are you using?

are you setting the local timezone? this recently fixed bug might be affecting you
https://luceeserver.atlassian.net/browse/LDEV-1700

Version that is shipped with coldbox. Lucee 4.5.5.006 . Is what Im using. Maybe its that. I checked the bug. I do have the regional settings set in the web context.