Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

php date question


lildog

Recommended Posts

I hope someone can shed some light on something for me. I put a snippet of code below. If a checkbox(today_date) is checked I want the current date put into $ustamp, when I echo ustamp or try to compare it to another date variable it is empty. BUT when I insert it into my DB it puts the correct date. So it appears to be a null variable but it is not......

 

 

if ($HTTP_POST_VARS['today_date']){

$utstamp =date("Y-m-d H:M:S");

}

 

Thanks for any help or pointers,

lildog

Link to comment
Share on other sites

I hope someone can shed some light on something for me. I put a snippet of code below. If a checkbox(today_date) is checked I want the current date put into $ustamp, when I echo ustamp or try to compare it to another date variable it is empty. BUT when I insert it into my DB it puts the correct date. So it appears to be a null variable but it is not......

 

 

if ($HTTP_POST_VARS['today_date']){

$utstamp =date("Y-m-d H:M:S");

}

 

Thanks for any help or pointers,

lildog

 

Well date("Y-m-d H:M:S"); is wrong for starters.

 

example: date("Y-m-d H:i:s");

Link to comment
Share on other sites

If you browse the php.net site, you can find all kinds of good info about the date(), strtotime(), and other date/time related functions, and you will find that other people have already done most of the work for you in the examples underneath the description of each function.

No Links To My Website Here!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...