///Singapore Time now() | Newbie | | Join Date: Sep 2008
Posts: 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>
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: ///Singapore Time now()
Is this for anywhere throughout the world? You only want to output Singapore time, not the local time?
| | Newbie | | Join Date: Sep 2008
Posts: 20
| | | re: ///Singapore Time now()
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
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: ///Singapore Time now()
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.
| | Newbie | | Join Date: Sep 2008
Posts: 20
| | | re: ///Singapore Time now()
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??
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: ///Singapore Time now()
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.
| | Newbie | | Join Date: Sep 2008
Posts: 20
| | | re: ///Singapore Time now()
sorry to ask
but is the statement as follow correct?? - <cfset curDate = Now()>
-
<cfset utcDate = DateConvert("local2utc", curDate)>
-
<cfoutput>#DATEADD(hh, 8, utcDate)#</cfoutput>
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: ///Singapore Time now()
The first parameter should be a string and it's "h", not "hh".
| | Newbie | | Join Date: Sep 2008
Posts: 20
| | | re: ///Singapore Time now()
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:
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: ///Singapore Time now()
As I said, it should be a string: - <cfoutput>#DATEADD("h", 8, utcDate)#</cfoutput>
| | Newbie | | Join Date: Sep 2008
Posts: 20
| | | re: ///Singapore Time now()
Ok, done, thanks.
A LOT !!
CHEERS! ;-)))))))))))))
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: ///Singapore Time now()
You're welcome. Glad it's working :)
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,449 network members.
|