Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-25-2010, 10:36 AM how to set timezone?
Junior Talker

Posts: 2
Name: Leong
Trades: 0
Hi,

i have the problem about the "date time" setting

this is the php code that i used to insert data to sql database
$Fname = $_POST["Fname"];
$Lname = $_POST["Lname"];
$gender = $_POST["gender"];
$sql="INSERT INTO $tbl_name(firstname, lastname, gender, datetime)
VALUES('$Fname', '$Lname','$gender', NOW() )";


when i submit data to database, the datetime data will be auto insert into datetime field. However, the date time is not same with my country time.

eg, data insert to database is (2010-12-25 15:21:36) , but it should be (2010-12-25 23:22:36)

for you information, im from Malaysia. Appreciate your help ....
thanks...
Sindy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-25-2010, 11:15 AM Re: how to set timezone?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The time will be the server time, you will have to make allowances for that when you are displaying or reading the data.

Unless you lease a server in your own time zone
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-27-2010, 04:31 AM Re: how to set timezone?
Junior Talker

Posts: 2
Name: Leong
Trades: 0
thanks for your info...

is it can do any coding to make the datetime value that based on Personal Computer time...?
Sindy is offline
Reply With Quote
View Public Profile
 
Old 12-27-2010, 04:54 AM Re: how to set timezone?
pedala's Avatar
Junior Talker

Latest Blog Post:
Starea vremii la Fetesti v.3
Posts: 4
Name: Ivanciu Vlad
Location: Romania
Trades: 0
Try this. http://php.net/manual/en/datetime.settimezone.php
I think is what you want
pedala is offline
Reply With Quote
View Public Profile Visit pedala's homepage!
 
Old 12-27-2010, 07:44 AM Re: how to set timezone?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,385
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.webmaster-talk.com/javasc...de-script.html
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-28-2010, 05:31 AM Re: how to set timezone?
Average Talker

Posts: 18
Name: David
Location: Sweden
Trades: 0
To set the timezone in a php script, simply use the inbuilt function date_default_timezone_set().

http://php.net/manual/en/function.da...mezone-set.php
__________________

Please login or register to view this content. Registration is FREE
- View random youtube videos easily & instantly!


Please login or register to view this content. Registration is FREE
- Dubstep.nu recommends great dubstep songs everyday!
FlyHour is offline
Reply With Quote
View Public Profile Visit FlyHour's homepage!
 
Old 12-28-2010, 09:02 AM Re: how to set timezone?
Banned

Posts: 21
Name: Salman
Trades: 0
simply use the inbuilt function date_default_timezone_set(). the Time zone will be selected............
Dorothy456 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to how to set timezone?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24834 seconds with 12 queries