Highlighted

coldfusion 2018 lsparsedatetime issue

New Here ,
Jan 25, 2019

Copy link to clipboard

Copied

i have some code which reads a datetime field from an sql database and then formats it using lsparsedatetime.

this has worked for years under previous CF versions and produces

{ts '2018-01-11 08:00:00'}

when passed

2018-01-11 08:00:00.0

read from SQL database.

when passing this in CF2018 it refuses to format it but produces no error just the original 2018-01-11 08:00:00.0

i have set <cfset loc = setlocale("English (UK)")>  on both machines

according to my hosting company the date/time settings are the same on both servers though the old server is running older versions of windows/iis/sql server

but as the db date is the same when retrieved from both databases i can only assume CF is the issue?

any help greatly appreciated

Views

259

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

coldfusion 2018 lsparsedatetime issue

New Here ,
Jan 25, 2019

Copy link to clipboard

Copied

i have some code which reads a datetime field from an sql database and then formats it using lsparsedatetime.

this has worked for years under previous CF versions and produces

{ts '2018-01-11 08:00:00'}

when passed

2018-01-11 08:00:00.0

read from SQL database.

when passing this in CF2018 it refuses to format it but produces no error just the original 2018-01-11 08:00:00.0

i have set <cfset loc = setlocale("English (UK)")>  on both machines

according to my hosting company the date/time settings are the same on both servers though the old server is running older versions of windows/iis/sql server

but as the db date is the same when retrieved from both databases i can only assume CF is the issue?

any help greatly appreciated

Views

260

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 25, 2019 0
LEGEND ,
Jan 25, 2019

Copy link to clipboard

Copied

Have you tried using DateTimeFormat()?

<cfset dttm = DateTimeFormat(#query_timestamp#,'yyyy-mm-dd HH:nn:ss') />

This should give you the format you desire.

V/r,

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 25, 2019 0
New Here ,
Jan 25, 2019

Copy link to clipboard

Copied

sure, yes there are solutions to code around the issue to get the required result but i have hundreds of places in several client sites that use this simple piece of code thats worked for 17 years!!!

i need a fix that doesnt require a code change

thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 25, 2019 0
Participant ,
Jan 26, 2019

Copy link to clipboard

Copied

How does your call to LSParseDateTime look? It accepts up to three arguments?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 26, 2019 0
New Here ,
Jan 27, 2019

Copy link to clipboard

Copied

no parameters as never needed any before. just lsparsedatetime(queryName.fieldName)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 27, 2019 0
Adobe Community Professional ,
Jan 27, 2019

Copy link to clipboard

Copied

Hi PaulWictyWatson​, it is unclear to me what the problem is. Which date format do you get in CF2018 and which do you expect?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 27, 2019 0
New Here ,
Jan 27, 2019

Copy link to clipboard

Copied

i get just the field as it comes back from the database in 2018 ie 2018-01-11 08:00:00.0

befoe 2018 i always got

{ts '2018-01-11 08:00:00'}

ie a VALID CF date

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 27, 2019 0
BKBK LATEST
Adobe Community Professional ,
Jan 27, 2019

Copy link to clipboard

Copied

On CF2018, the code

<cfset setlocale("English (UK)")>

<cfoutput>#lsparsedatetime("2018-01-11 08:00:00.0")#</cfoutput>

gives me

{ts '2018-01-11 08:00:00'}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 27, 2019 0