HTMLGoodies
The ultimate html resource
Earthweb.com


About the Double-Underlined Links



Search Clipart.com:



internet.commerce
Phone Cards
Send Text Messages
Online Education
Home Improvement
Memory Upgrades
Shop
Web Design
KVM over IP
Promotional Gifts
Imprinted Gifts
Promote Your Website
Televisions
Cell Phones
Memory

HTML Goodies : Beyond HTML : Webmaster Tips: SSI: Dates and Times

 Silverlight 2 SDK for Visual Studio 2008
This package is an add-on to the RTM release of Visual Studio 2008 to provide tooling for Microsoft Silverlight 2 Beta 1. It provides a Silverlight project system for developing Silverlight applications using C# or Visual Basic. »
 
 Article: What Does it Take to Build the Best RIA?
With the proliferation of Rich Interactive Application (RIA) platform choices out there, you no longer have to take a one-size-fits-all approach to developing your next RIA application. Knowing the strengths (and weaknesses) of each platform can help you to decide the best RIA for your next application. »
 
 Expression Blend 2.5 Preview
Use Expression Blend 2.5 to create and modify managed Silverlight 2-based applications. Expression Blend for Silverlight 2 includes all of the features in Expression Blend 2 but has not reached the quality level of Expression Blend 2 for WPF or Silverlight 1 development. »
 
 The Hottest Mobile Platform Meets the Hottest RIA Platform
With the Symbian OS now supporting Microsoft Silverlight, mobile developers can bring new and exciting capabilities to handsets all over the globe. Find out why developers now need to make mobile devices a core part of their RIA development strategy. »
 
 Article: Leveraging Your Flash Development with Silverlight
You're not giving up Flash any time soon (and we don't blame you.) But if you could get your Flash application working in Silverlight, why wouldn't you? We show you the tools and techniques required to have your rockin' Flash application rolled for Silverlight. »
 

HTML GOODIES TO GO NEWSLETTER


Other Related Newsletters

Visit ThreadingBuildingBlocks.org: Threading Building Blocks (TBB) is now open sourced and supported by some very impressive veteran parallelism experts. Come check it out!

SSI: Dates and Times


By Joe Burns

Use these to jump around or read it all...
[Config and Echo]
[The timefmt Argument]
[The Codes]
[Multiple Codes]

This is the second in a series of three tutorials on SSIs (Server Side Includes). These are commands from the PERL language that allow you to include files and information right from the server.

If you haven't already, please take the time to read the original SSI tutorial first.

In that tutorial you'll get a little script that allows you to test your server to see if you're even able to play with these commands, and a lesson on the "include" command. It's best that you do read that first because I'm going to assume you have at this point and just bull forward.

Bull, bull, bull...


Config and Echo

Let's talk about the basic format first. Once we have that, then the rest is a simple chart of what argument returns what. Here's the format:

<!--#config timefmt="--" --> <!--#echo var="DATE_LOCAL" -->

The format for these includes is quite rigid. You must keep it the same. Do not put in spaces where they don't now appear. HTML is flexible. This is not. The biggest mistake I make is not having a space just before the final two dashes at the end of the command lines. Make sure that's in there. You don't get error warnings with these commands. They simply fail to work and you can spend hours trying to figure out what's wrong when it's only a missing space.

I guess the point I'm making is to not mess with the layout of the command line.

That said, look at what we have here. It's actually two command lines, one after the other. The first command line denotes the time format and the second echoes it back. See that?

Let me start with the second one because that's the one that requires the least amount of work. In fact, it requires no work. Leave it the way it is. The echo command should always have the var argument set to "DATE_LOCAL", in caps, with an underscore between the words.

Every time you set an include to grab a date or a time, always follow that command with this echo command line so it echoes back and gets posted to the page.

I think I've driven that point into the ground.


The timefmt Argument

Moving backward, we get to the first command line. That's the one that reads #config timefmt="--".

The leading hash mark (#) is required, keep it. The argument "timefmt=" is used every time you want to return a date or time. The big question is what you want returned. There are 21 choices, each identified by a percent mark, a one-letter code that goes in between the quotes following "timefmt=".


The Codes

The codes make little sense to me. They don't seem to represent what they return, so you'll need some kind of chart to keep it all straight. I have one below.

I'll use the first code, %a, to demonstrate a command line. The code %a will return the abbreviated weekday name (Mon, Tue, Wed) depending on the current local. The command would look like this:

<!--#config timefmt="%a" --> <!--#echo var="DATE_LOCAL" -->

     ...and here's what it gives you: Sat

There's no need looking at the source code to see how I placed the command lines because they won't be there. Only the return provided by the server will display.

Here are all 21 timefmt arguments, what you'll get, and an example.

Argument You Get: It Looks Like:
%a Abbreviated Weekday Name Sat
%A Full Weekday Name Saturday
%b Abbreviated Month Name May
%B Full Month Name May
%c Preferred Date & Time Sat May 17 01:17:53 2008
%d Day of Month as digit 17
%H Hour Number (24-Hour Clock) 01
%I Hour Number (12-Hour Clock) 01
%j Day of the Year Number 138
%m Month as digit 05
%M Minute Number 05
%p AM or PM AM
%S Second Number 1211001473
%U Week Number/Sunday as Day One 19
%w Day of the Week Number 6
%x Preferred Format without Time 05/17/08
%X Preferred Format without Date 01:17:53
%y Two-Digit Year Number 08
%Y Four-Digit Year 2008
%Z Time Zone EDT

You might notice that some of the elements claim they represent the "preferred" format; "preferred" means the default settings of the server. It can differ from server to server.

Notice also that these returns are from the server. If you are in one time zone and the server is in another, the time zone the server is in will be reflected in the returned values.


Multiple Codes

The codes above can be used one right after another to create a longer date/time stamp. Let's say you want something that looks like this:

Wednesday, January 26, 2000

You could set up an SSI that looks like this:

<!--#config timefmt="%A, %B %d, %Y" --> <!--#echo var="DATE_LOCAL" -->

See how one just followed the other? The commas are in there, too. You can make up any combination you want by just following one with the other, leaving spaces and putting commas where you want them. Very cool.


That's That

These are great includes. My school Webmaster uses them to death. Hopefully, you too can find a use for them.

Keep in mind that I also have the original SSI include tutorial and the SSI tutorial on file returns.

 

Enjoy!

 

[Config and Echo]
[The timefmt Argument]
[The Codes]
[Multiple Codes]

Tools:
Add htmlgoodies.com to your favorites
Add htmlgoodies.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

IT Management Networking & Communications Web Development Hardware & Systems Software Development Earthwebnews.com



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: Will Hyper-V Make VMware This Decade's Netscape?
Microsoft Article: 7.0, Microsoft's Lucky Version?
Microsoft Article: Hyper-V--The Killer Feature in Windows Server 2008
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Windows Server 2008
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES