By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,307 Members | 2,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,307 IT Pros & Developers. It's quick & easy.

///Singapore Time now()

P: 20
1. If i need to add into the database time now() of singapore time, how do i do it??


now() + ______



2. If I need to output the time now of singapore , how??

<cfoutput>#now() + __________#</cfoutput>
Oct 4 '08 #1

✓ answered by acoder

As I said, it should be a string:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput>#DATEADD("h", 8, utcDate)#</cfoutput>

Share this Question
Share on Google+
11 Replies


acoder
Expert Mod 15k+
P: 16,027
Is this for anywhere throughout the world? You only want to output Singapore time, not the local time?
Oct 4 '08 #2

P: 20
Yes for sigapore time only

because I want to set now() Singapore time to add to the database



<cfset form.aaDate='#now()#'>

where aaDate is always the singapore time.

thanks
Oct 6 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Try the DateConvert() function. If the local computer is Singapore time, then that should be OK. If not, you'll have to convert it. TimeZoneInfo() may help too.
Oct 6 '08 #4

P: 20
The server is a US server
so time now is not accurate

<cfset curDate = Now()>

<cfset utcDate = DateConvert("local2utc+8", curDate)>


How do I add +8 hours to the UTC time??
Oct 8 '08 #5

acoder
Expert Mod 15k+
P: 16,027
You could try converting the locale using setLocale(). If that doesn't give the desired result, then for want of a better solution, try DateAdd with the number of hours from UTC.
Oct 8 '08 #6

P: 20
sorry to ask

but is the statement as follow correct??


Expand|Select|Wrap|Line Numbers
  1. <cfset curDate = Now()>
  2. <cfset utcDate = DateConvert("local2utc", curDate)>
  3. <cfoutput>#DATEADD(hh, 8, utcDate)#</cfoutput>
Oct 8 '08 #7

acoder
Expert Mod 15k+
P: 16,027
The first parameter should be a string and it's "h", not "hh".
Oct 8 '08 #8

P: 20
I get an error

ts '2008-10-08 09:36:18'} {ts '2008-10-08 16:36:18'}

The web site you are accessing has experienced an unexpected error.
Please contact the website administrator.

The following information is meant for the website developer for debugging purposes.

Error Occurred While Processing Request
Variable H is undefined.


Resources:
Oct 8 '08 #9

acoder
Expert Mod 15k+
P: 16,027
As I said, it should be a string:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput>#DATEADD("h", 8, utcDate)#</cfoutput>
Oct 8 '08 #10

P: 20
Ok, done, thanks.

A LOT !!

CHEERS! ;-)))))))))))))
Oct 9 '08 #11

acoder
Expert Mod 15k+
P: 16,027
You're welcome. Glad it's working :)
Oct 9 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.