function format_date
Search API
7.x theme.inc | format_date($timestamp = 0, $format = "standard", $custom = "") |
6.x theme.inc | format_date($timestamp = 0, $format = "standard", $custom = "") |
4.x theme.inc | format_date($timestamp, $format = "standard", $custom = "") |
5.x theme.inc | format_date($timestamp = 0, $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
- just_time
40 calls to format_date()
- admin_display_watchdog in modules/
admin/ admin.module - 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.
- AdvisingScreen::build_test_scores in classes/
AdvisingScreen.php - Constructs the HTML to show the student's test scores.
4 string references to 'format_date'
- announcements_content_register_content_type in modules/
announcements/ announcements.module - Implementatin of content's hook_content_register_content_type
- calendar_content_register_content_type in modules/
calendar/ calendar.module - For use with the content module. We will register our custom content type(s) for use with this module.
- content_content_load in modules/
content/ content.module - Implementation of content's hook_content_load
- engagements_content_register_content_type in modules/
engagements/ engagements.module - For use with the content module. We will register our custom content type(s) for use with this module.
File
- includes/
theme.inc, line 499
Code
function format_date($timestamp = 0, $format = "standard", $custom = "") {
if (!is_numeric($timestamp)) {
$timestamp = 0; // make sure it's numeric.
}
if ($timestamp == 0) {
$timestamp = strtotime("now");
}
$f = "";
if ($format == "standard") {
$f = "n/d/Y h:i:sa";
}
if ($format == "short") {
$f = "n/d/Y - g:ia";
}
if ($format == "pretty") {
$f = "F jS, Y, g:ia";
}
if ($format == 'long_no_year') {
$f = 'l, F jS \a\t g:ia';
}
if ($format == "just_date") {
$f = "F jS, Y";
}
if ($format == 'just_time') {
$f = "g:ia";
}
if ($custom != "") {
$f = $custom;
}
return date($f, $timestamp);
}