PHP Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
PHP Topics
Introduction Introduction
Syntax Syntax
Data Types Data Types
Operators Operators
Control Structures Control Structures
Functions Functions
Pre-defined Function Pre-defined Function
Calendar Functions Calendar Functions
Date and Time Date and Time
Array Functions Array Functions
Array List Array Functions List1
Array Function List Array Functions List2
Math Functions Math Functions
PHP MYSQL Functions PHP Mysql Functions
File Handling File Handling
Error Handling Error Handling
DB Size DB Size
PHP Mail PHP Mail
String Tokens String Tokens
String Functions String Functions
String Functions List String Functions List1
String Functions List2 String Functions List2
Session Functions Session Functions
Cookies Functions Cookies Functions
Form Variables Form Variables
Running PHP from JS Running PHP from JS
Array To JS Array To JS
JS Array Array to PHP
Encryption Encryption
Common Header Common Header
Forums Ask Your Doubts
Scraps More about PHP
Feedback Feedback
 




PHP idate() Function


Tutorials »Php »

Topic

What is a idate Function?



Explanation

The "idate()" function is used to format a local time/date as integer.

Syntax:
    idate(format,timestamp)

In the above syntax the parameters for the function are "format", which specifies the format of the output, timestamp, is a default field which specifies date or time to be formatted, if not specified it will take default Current Time.

The following are the format parameters for idate() function.

Format Description
B Swatch Beat/Internet Time
d Day of the month
h Hour (12 hour format)
H Hour (24 hour format)
i Minutes
I returns 1 if DST (daylight saving time) is activated, 0 otherwise
L returns 1 for leap year, 0 otherwise
m Month number
s Seconds
t Days in current month
U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
w Day of the week (Sunday=0)
W ISO-8601 week number of year (week starts on Monday)
y Year (1 or 2 digits)
Y Year (4 digits)
z Day of the year
Z Timezone offset in seconds
Example:
    <?php
    $timestamp = strtotime('1st February 2006'); //1072915200
    // this prints the year in a two digit format
    // however, as this would start with a "0", it
    // only prints "6"
    echo idate('y', $timestamp);
    ?>
Result:
    6

In the above example the format 'y' returns the value of a year in a two digit format, since the year specified is "2006", first digit is 0, it displays 6.

Note: (PHP 5)






A Note

Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial. Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.

Other Links

web hosting