Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old October 4th, 2008, 07:12 AM
Newbie
 
Join Date: Sep 2008
Posts: 20
Default ///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>
Reply
  #2  
Old October 4th, 2008, 01:24 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

Is this for anywhere throughout the world? You only want to output Singapore time, not the local time?
Reply
  #3  
Old October 6th, 2008, 02:54 PM
Newbie
 
Join Date: Sep 2008
Posts: 20
Default

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
Reply
  #4  
Old October 6th, 2008, 02:59 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

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.
Reply
  #5  
Old October 8th, 2008, 06:25 AM
Newbie
 
Join Date: Sep 2008
Posts: 20
Default

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??
Reply
  #6  
Old October 8th, 2008, 08:01 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

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.
Reply
  #7  
Old October 8th, 2008, 10:09 AM
Newbie
 
Join Date: Sep 2008
Posts: 20
Default

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>

Last edited by acoder; October 8th, 2008 at 11:02 AM. Reason: Added [code] tags
Reply
  #8  
Old October 8th, 2008, 11:05 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

The first parameter should be a string and it's "h", not "hh".
Reply
  #9  
Old October 8th, 2008, 05:41 PM
Newbie
 
Join Date: Sep 2008
Posts: 20
Default

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:
Reply
  #10  
Old October 8th, 2008, 05:57 PM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

As I said, it should be a string:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput>#DATEADD("h", 8, utcDate)#</cfoutput>
Reply
  #11  
Old October 9th, 2008, 01:23 AM
Newbie
 
Join Date: Sep 2008
Posts: 20
Default

Ok, done, thanks.

A LOT !!

CHEERS! ;-)))))))))))))
Reply
  #12  
Old October 9th, 2008, 08:13 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

You're welcome. Glad it's working :)
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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.
Post your question now . . .
It's fast and it's free

Popular Articles