T4VN is an online PHP Help community that provides PHP Tutorials, PHP Examples, PHP Scripts, PHP Support
    HOME  |  HOSTING COUPON  |  TEMPLATE  |  PHP SCRIPTS  |  LINK TO US  |  LINK  |  REGISTER | CONTACT
::: Member Login :::
 Username
 Password
 
Forgot your password ?
::: PHP Tutotal :::
  PHP Basic (7)
  PHP Advanced (4)
  PHP Database (2)
  Coding Step By Step (8)
  PHP and AJAX (0)
::: PHP Example :::
  Arrays (1)
  Code Highlighters (3)
  Database Functions (12)
  Date & Time (5)
  E-Mail (6)
  Forms (5)
  Guestbooks (1)
  Logging (2)
  Miscellaneous (10)
  Password Generators (3)
  Randomizers (3)
  String Manipulation (10)
  User Authentication (6)
::: Search On T4VN :::
::: T4VN Statistics :::
  PHP Scripts : 64
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 93
  Total Coupon : 36
  Other Tutorials :
  Member : 215
  Visitor Online : 2
  Today Visit: 326
  Total Visitor : 301348
  Most Online : 41
::: Sponsored Links :::

PR 4 For This Webpage

Vinaora Logo
Home Today :

Date Convert Function

Author : IceZero||

Allows you to conver standard MYSQL date format into any types of format. Very customizable and useful when creating calendars and such.

PHP Example :

<?php
function date_convert($date,$type){
  
$date_year=substr($date,0,4);
  
$date_month=substr($date,5,2);
  
$date_day=substr($date,8,2);
  if(
$type == 1):
      
// Returns the year Ex: 2003
      
$date=date("Y"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 2):
      
// Returns the month Ex: January
      
$date=date("F"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 3):
      
// Returns the short form of month Ex: Jan
      
$date=date("M"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 4):
      
// Returns numerical representation of month with leading zero Ex: Jan = 01, Feb = 02
      
$date=date("m"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 5):
      
// Returns numerical representation of month without leading zero Ex: Jan = 1, Feb = 2
      
$date=date("n"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 6):
      
// Returns the day of the week Ex: Monday
      
$date=date("l"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 7):
      
// Returns the day of the week in short form Ex: Mon, Tue
      
$date=date("D"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 8):
      
// Returns a combo ExL Wed,Nov 12th,2003
      
$date=date("D, M jS, Y"mktime(0,0,0,$date_month,$date_day,$date_year));
  elseif(
$type == 9):
      
// Returns a combo Ex: November 12th,2003
      
$date=date("F jS, Y"mktime(0,0,0,$date_month,$date_day,$date_year));
  endif;
  return 
$date;
};
?>


Other Example


::: Resources :::
  Links Directory
  Programming 2 3
  Webmaster 2 3
  Web Design 2 3
  Web Hosting 2 3
  Other Links 2 3
  Asian ShowBiz News
  Teach Seo For You
::: New Templates :::




::: Other Tutorials :::
 Program Design

  Powered By T4VN.NET - Version 2.0 - CopyRight © T4VN.NET 2005-2007