Date/Time in correct format

Jun 30

Here is a simple way to get two variables that contain the current datetime in the current user’s preferred format and in the correct database format.  Use $now_user to set datetime values on SugarBean objects and $now_db to set datetime values in database queries.

  1. global $timedate;
  3. $now_db = $timedate->get_gmt_db_datetime();
  4. $now_user = date($timedate->get_date_time_format());



Comments are closed.

Not unto the swift…

The race is not to the swift or the battle to the strong, nor does food come to the wise or wealth to the brilliant or favor to the learned; but time and chance happen to them all.
— Ecclesiates 9:11 (NIV)