Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Created December 30, 2024 19:02
Show Gist options
  • Save JamoCA/d7b6c8056e03a95ff7613396ecbf5f14 to your computer and use it in GitHub Desktop.
Save JamoCA/d7b6c8056e03a95ff7613396ecbf5f14 to your computer and use it in GitHub Desktop.
Generates an RFC9110 8.8.2 compliant Last-Modified date string for use in an HTTP header using ColdFusion / CFML.
<cfscript>
public string function makeLastModifiedDate(date date=now(), boolean isLocal=true) hint="Generates an RFC9110 8.8.2 compliant Last_Modified date string for use in an HTTP header" {
local.d = (arguments.isLocal) ? dateConvert('local2Utc',now()) : arguments.date;
return datetimeformat(local.d, "ddd, d mmm yyyy hh:nn:ss") & " GMT";
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment