 | 
October 4th, 2008, 07:12 AM
| | Newbie | | Join Date: Sep 2008
Posts: 20
| | ///Singapore Time now()
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>
| 
October 4th, 2008, 01:24 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,766
| |
Is this for anywhere throughout the world? You only want to output Singapore time, not the local time?
| 
October 6th, 2008, 02:54 PM
| | Newbie | | Join Date: Sep 2008
Posts: 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
| 
October 6th, 2008, 02:59 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,766
| |
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.
| 
October 8th, 2008, 06:25 AM
| | Newbie | | Join Date: Sep 2008
Posts: 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??
| 
October 8th, 2008, 08:01 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,766
| |
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.
| 
October 8th, 2008, 10:09 AM
| | Newbie | | Join Date: Sep 2008
Posts: 20
| |
sorry to ask
but is the statement as follow correct?? - <cfset curDate = Now()>
-
<cfset utcDate = DateConvert("local2utc", curDate)>
-
<cfoutput>#DATEADD(hh, 8, utcDate)#</cfoutput>
Last edited by acoder; October 8th, 2008 at 11:02 AM.
Reason: Added [code] tags
| 
October 8th, 2008, 11:05 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,766
| |
The first parameter should be a string and it's "h", not "hh".
| 
October 8th, 2008, 05:41 PM
| | Newbie | | Join Date: Sep 2008
Posts: 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:
| 
October 8th, 2008, 05:57 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,766
| |
As I said, it should be a string: - <cfoutput>#DATEADD("h", 8, utcDate)#</cfoutput>
| 
October 9th, 2008, 01:23 AM
| | Newbie | | Join Date: Sep 2008
Posts: 20
| |
Ok, done, thanks.
A LOT !!
CHEERS! ;-)))))))))))))
| 
October 9th, 2008, 08:13 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,766
| |
You're welcome. Glad it's working :)
|  |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
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 network members.
|