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 gmstrftime() Function


Tutorials »Php »

Topic

What is a gmstrftime Function?



Explanation

The "gmstrftime()" function is used to format a GMT/UTC time/date according to local settings.

Syntax:
    gmstrftime(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 GMT Time.

Example:
    <?php
    echo(strftime("%b %d %Y %X", mktime(20,0,0,12,31,98)));
    echo(gmstrftime("%b %d %Y %X", mktime(20,0,0,12,31,98)));
    //Print the current date, time, and timezone.
    echo(gmstrftime("It is %a on %b %d, %Y, %X time zone: %Z",time()));
    ?>
Result:
    Dec 31 1998 20:00:00
    Dec 31 1998 19:00:00
    It is Wed on Jan 25, 2006, 11:32:10 time zone: W. Europe Standard Time

In the above example the gmstrftime() function first returns the values without formatting, the second one returns the values in the desired string format.

Note: (PHP 4, 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