Technical References - [date]

Putting [date] in your template displays the current date as defined by the clock on your web server. The format of the date is normally MM/DD/YYYY, but you can change the default format by changing the DateFormat preference in the WebDNA settings. You can override the default date format preference on a case-by-case basis by specifying a format inside the tag, as shown below. See [Time] for similar time formats.

[date] --> 08/14/2010
[date %A, %B %d, %Y] --> Thursday, August 14, 2010

Remember, this tag displays the current server date and time. To add formatting to dates retrieved from a database, see [format] for Dates and Times

Here are the valid date and time formats (case sensitive):
Format: Description
%a....: Abbreviated weekday name "Wed"
%A....: Full weekday name "Wednesday"
%b....: Abbreviated month name "Feb"
%B....: Full month name "February"
%c....: Date and time "Wed Sep 19 18:24:21 2010"
%d....: Day of month 01-31
%H....: Hour 00-23
%I....: Hour 01-12
%j....: Day of year 001-365
%m....: Month 01-12
%M....: Minute 00-59
%p....: AM or PM
%S....: Seconds 00-59
%U....: Week # of year, Sunday first day of week
%w....: Weekday 0 (Sunday) - 6 (Saturday)
%W....: Week # of year, Monday first day of week
%x....: Date as Sep 11 2008
%X....: Time as 14:01:12
%y....: Year without century 00-99
%Y....: Year with century 1900-2199
%z....: offset of server
%Z....: Time zone of server
%%....: %

the [date] tag is sometimes confused with the [orderfile]'s [date] tag, which is not the same thing. The [date] tag inside the context of an [orderfile] represents the date the order was created, and does not have the ability to be formatted in special ways. If you want to display today's date inside of an [orderfile], then you must first assign a text variable outside the OrderFile context, and use that text variable from then on:


[text]todaysdate=[date][/Text]
[orderfile cart=[cart]]
Order Date: [date]
Today: [todaysdate]
[/orderfile]

The format of the date is normally MM/DD/YYYY, but you can change the default format by changing the DateFormat preference in your WebDNA admin area. You can also override the default date format by specifying a format inside the tag, such as [date %A, %B %d, %Y], which resolves to this style: Thursday, August 14, 2008.

Use these formats in the DATE tag, which can be combined with ordinary characters, such as the comma, slash and space.

Mix and match:
[TIME %A, %I:%M %p] --> Friday, 10:30 AM
[date %A, %I:%M %p] --> Friday, 10:30 AM

[date format=%I:%M %p] is the same thing as [date %I:%M %p]


If you need to remove the leading "0" before the day or the month, this will do the trick:

[grep search= 0&replace= ]
[format Days_To_Date %A, %B %d, %Y][math]{[date]}[/math][/format]
[/grep]

It will show
"Friday, January 1, 2010"
instead of
"Friday, January 01, 2010"


ambiguous dates/times
If your dates contain a decimal point "." in them, then the [math] context will interpret them as Times instead of Dates. You can force it to interpret some text as a Date by inserting a "D" in front of the text, as in [math]{D10.01.2010}[/math], so that 10.01.2010 is interpreted as a date instead of a time. You can force Time interpretation by using "T" in place of the "D".

WebDNA Team

DOWNLOAD WEBDNA NOW!

Top Articles:

[biotype]

BioType is a behavioral biometrics WebDNA function based on ADGS research and development (from version 8...

Technical Change History

This Technical Change History provides a reverse chronological list of WebDNA changes...

Download WebDNA Applications

WebDNA applications...

WebDNA Modules

A list of the currently available modules...

WebDNA Libraries

A list of available libraries for WebDNA...

Tips and Tricks

A list of user-submitted tips ...

Related Readings:

[input]

[url]...

[getchars]

Extracts a portion of the text (also known as substring or Mid$)...

[object]

Embeds the results of an external function...

[showif]

[showif Comparison]Show This HTML[/showif]...

[url]

[url]...

[sendmail]

There is hardly a website that doesn't at some point need to send an email...