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 : 35
  PHP Example : 67
  PHP Tutorials : 21
  PHP News : 91
  Total Coupon : 36
  Other Tutorials :
  Member : 167
  Visitor Online : 1
  Today Visit: 320
  Total Visitor : 84044
  Most Online : 25
::: Sponsored Links :::

PR 4 For This Webpage
Home Today :

Time Convert Function

Author : IceZero||

This converts time given in regular MYSQL time format such as 00:00:00, into any different formats.

PHP Example :

<?php
function time_convert($time,$type){
  
$time_hour=substr($time,0,2);
  
$time_minute=substr($time,3,2);
  
$time_seconds=substr($time,6,2);
  if(
$type == 1):
      
// 12 Hour Format with uppercase AM-PM
      
$time=date("g:i A"mktime($time_hour,$time_minute,$time_seconds));
  elseif(
$type == 2):
      
// 12 Hour Format with lowercase am-pm
      
$time=date("g:i a"mktime($time_hour,$time_minute,$time_seconds)); 
  elseif(
$type == 3):
      
// 24 Hour Format
      
$time=date("H:i"mktime($time_hour,$time_minute,$time_seconds)); 
  elseif(
$type == 4):
      
// Swatch Internet time 000 through 999
      
$time=date("B"mktime($time_hour,$time_minute,$time_seconds)); 
  elseif(
$type == 5):
      
// 9:30:23 PM
      
$time=date("g:i:s A"mktime($time_hour,$time_minute,$time_seconds));
  elseif(
$type == 6):
      
// 9:30 PM with timezone, EX: EST, MDT
      
$time=date("g:i A T"mktime($time_hour,$time_minute,$time_seconds));
  elseif(
$type == 7):
      
// Different to Greenwich(GMT) time in hours
      
$time=date("O"mktime($time_hour,$time_minute,$time_seconds)); 
  endif;
  return 
$time;
};
?>


Other Example
Date Convert Function


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




::: Other Tutorials :::
 Program Design

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