format_date

4.x theme.inc format_date($timestamp, $format = "standard", $custom = "")

Format a timestamp using the date command. TODO: Make the formats something which can be controlled through the settings.

Available formats:

  • standard
  • short
  • pretty
  • just_date
16 calls to format_date()
admin_display_watchdog in modules/admin/admin.module
Displays recent watchdog entries, from the watchdog table
admin_display_watchdog_entry in modules/admin/admin.module
Display the details of a particular watchdog entry, specified by its table id.
advise_display_history in modules/advise/advise.history.inc
Displays the history tab on screen.
advise_popup_display_summary in modules/advise/advise.history.inc
Displays the printable advising summary.
comments_render_comment in modules/comments/comments.module
Display the comment array in a pretty way.

... See full list

File

includes/theme.inc, line 34

Code

function format_date($timestamp, $format = "standard", $custom = "") {

  if (!is_numeric($timestamp)) {
    $timestamp = 0; // make sure it's numeric.
  }

  $f = "";
  if ($format == "standard") {
    $f = "n/d/Y h:i:sa";
  }

  if ($format == "short") {
    $f = "n/d/Y - g:i";
  }

  if ($format == "pretty") {
    $f = "F jS, Y, g:ia";
  }

  if ($format == "just_date") {
    $f = "F jS, Y";
  }

  if ($custom != "") {
    $f = $custom;
  }

  return date($f, $timestamp);


}