Home arrow PHP arrow Page 6 - Working with Dates and Times in PHP
PHP

Working with Dates and Times in PHP


In this article Hermawan will teach you how to work with the date and time functions in PHP in a way such that your site will not suffer from jet lag.

Author Info:
By: Hermawan Haryanto
Rating: 4 stars4 stars4 stars4 stars4 stars / 18
March 07, 2003
TABLE OF CONTENTS:
  1. · Working with Dates and Times in PHP
  2. · First Step
  3. · Display it to human readable date and time format
  4. · Make my own date time
  5. · Another method
  6. · My own Language

print this article
SEARCH DEVARTICLES

Working with Dates and Times in PHP - My own Language
(Page 6 of 6 )

By this time I hope you can create your own date and time using the timestamp of the current date or your own timestamp. I'm not using English as my primary language, and neither are my website users. We are from Indonesia and I want to display the date in Indonesian language. How can I do it? That's a perfect question and asked by most beginners.

Let's create an associative array of date and month in our own language.

$days = Array ("Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu");
$months = Array (1=>"Januari",
                 2=>"Pebruari",
                 3=>"Maret",
                 4=>"April",
                 5=>"Mei",
                 6=>"Juni",
                 7=>"Juli",
                 8=>"Agustus",
                 9=>"September",
                10=>"Oktober",
                11=>"Nopember",
                12=>"Desember");

After we create our own language of date and months, now it's time to display it.

print $days[date("w")]; // display name of day with our own language
print $months[date("n")];

Ok guys, that's it for today. We'll see you again next time.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials