• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

convert to server time is getting mixed up

Guest
Feb 02, 2008 Feb 02, 2008

Copy link to clipboard

Copied

Hi my web server is in delaware USA i have a timezone converter below which is 30 mins and the year is 2006 not 2008

any ideas why this would be and what i need to do to fix

what i need is the equivilent server datetime for the entry of the form so the hard coded date and time below should have a serverDate of ts '2008-02-02 11:30:00' but it is {ts '2006-02-01 11:00:00'}

any ideas?


<cfset startday = '02/02/2006'> // format is in dd / mm / yyyy
<cfset SMS_Time = '03:30:00'>

<cfscript>
tz=createObject("component","timeZone");
setLocale("English (Australian)");
smsDate=lsParseDateTime(startday);
hours=listFirst(SMS_Time,":")+listGetAt(SMS_Time,2,":")/60+listLast(SMS_Time,":")/360;
smsDate=dateAdd("h",hours,smsDate);
serverDate=tz.castToServer(smsDate,"Australia/Sydney");
</cfscript>
TOPICS
Advanced techniques

Views

188

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
community guidelines
LEGEND ,
Feb 02, 2008 Feb 02, 2008

Copy link to clipboard

Copied

LATEST
I can see why you got 2006 instead of 2008.

For the rest of it, do a writeoutput every time you set a variable and then you'll where you start getting unexpected values.

Votes

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
community guidelines
Resources
Documentation