473,467 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

///Singapore Time now()

20 New Member
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>

11 3958
acoder
16,027 Recognized Expert Moderator MVP
Is this for anywhere throughout the world? You only want to output Singapore time, not the local time?
Oct 4 '08 #2
freddie007
20 New Member
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
16,027 Recognized Expert Moderator MVP
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
freddie007
20 New Member
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
16,027 Recognized Expert Moderator MVP
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
freddie007
20 New Member
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
16,027 Recognized Expert Moderator MVP
The first parameter should be a string and it's "h", not "hh".
Oct 8 '08 #8
freddie007
20 New Member
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
16,027 Recognized Expert Moderator MVP
As I said, it should be a string:
Expand|Select|Wrap|Line Numbers
  1. <cfoutput>#DATEADD("h", 8, utcDate)#</cfoutput>
Oct 8 '08 #10
freddie007
20 New Member
Ok, done, thanks.

A LOT !!

CHEERS! ;-)))))))))))))
Oct 9 '08 #11
acoder
16,027 Recognized Expert Moderator MVP
You're welcome. Glad it's working :)
Oct 9 '08 #12

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

Similar topics

1
by: Simon Gare | last post by:
Hi I need to Flash dynamic text on ASP page if the time in the record is less than 20 minutes from NOW() time. Thanks in advance Simon
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
18
by: Tim Quon | last post by:
Hi I need to print the current time. I found an example where this is done as followed: long *mytime; time(mytime); printf("time: %s", ascitime(mytime); But this doesn't work and prints...
6
by: Wei Jones | last post by:
Hi, all I got a problem as subject title. I create a pthread which like : static time_t *Now; void get_time(void *tmp) { while(1) { time(&Now); disp_time_somewhere(); sleep(1);
2
by: Suresh | last post by:
hello, i am new to c and how do i use time function to get time. thanks, Sean
1
by: Asad | last post by:
Hi, I was wondering how I can find out the time user takes on an aspx page before hitting a submit button. Since there is that whole server-side vs. client-side issue, I was thinking I can store...
18
by: Max | last post by:
This is a follow-up on my previous thread concerning having the program wait for a certain date and time and then executing some code when it gets there. My question is; can I use the Sleep...
1
by: Gary Wessle | last post by:
Hi could someone please tell us how to do this: my PC time is set to Australia/Sydney. I need New York time epoch using libboost_date_time thank you #include <iostream>
2
by: idealfellow | last post by:
I am using the following to get the time: puts Time.now --> starting of my script <MY CODE> puts Time.now --> end of my script I want to get the Time difference between two Time.now...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.