•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,708 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,342 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1094 | Replies: 8 | Solved
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
If you want current date and time to insert to a table, you can use now() function of mysql.
http://dev.mysql.com/doc/refman/5.1/...l#function_now
http://dev.mysql.com/doc/refman/5.1/...l#function_now
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
php Syntax (Toggle Plain Text)
<?php $time_now=mktime(date('h')+5,date('i')+30,date('s')); print "<br>".date('h:i:s A',$time_now); ?>
Thats for php.
Cheers,
Naveen
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
I am getting the right output. i am getting 03:14:16 PM which is the right time.
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
date('h')+5 will add 5 hrs to UTC time.
date('i')+30 will add 30 mins to UTC time.
Since we are 5-30 hrs ahead of UTC time, i am sure this will work. It probably wont work if you have set some other timezone.
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
date('h')+5 will add 5 hrs to UTC time.
date('i')+30 will add 30 mins to UTC time.
Since we are 5-30 hrs ahead of UTC time, i am sure this will work. It probably wont work if you have set some other timezone.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 238
<br> is to give a line break. That doesnt make any difference. Do you want indian time to be put in a text box ? Try this.
php Syntax (Toggle Plain Text)
<html> <body> <?php $time_now=mktime(date('h')+5,date('i')+30,date('s')); $time_now=date('h:i:s A',$time_now); ?> Time: <input type="text" name="dat1" value="<?php echo $time_now; ?>"> </body> </html>
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- ambiguous part 3 (C)
- Sr. PHP Programmer -- Looking for outsourcing work (Post your Resume)
- Only 5 days left - $1.66/mo, 250 MB Space, Windows/Linux Shared Hosting! (Web Hosting Deals)
- need help with the login (PHP)
Other Threads in the PHP Forum
- Previous Thread: dreamweaver $insertGoTo generated code
- Next Thread: Meta Keyword Generator



Linear Mode