Associate Engine : Clock Codes  
Home > Associate Engine > Documentation > Clock Codes

Clock Codes

Browse Clock Codes
 


Syntax of Clock Codes

The {date} substitution variable lets you specify an optional clock code so you can specify the format of the date. Some other substitution variables such as {asOfDate} also support clock codes. Some script parameters also support clock codes.

The syntax of clock codes is % followed by a letter. For example, %Y shows the year as 4-digits. You can use more than one %LETTER code, such as %b/%d/%Y to show the month/day/year. Characters that do not have a preceding % are copied as-is to the result.

Example Example Result
{date Today is %b %d %Y} Today is Jun 27 2003
{date %I:%M %p} 10:32 PM


Time Codes

The following time codes can be used to display various components of time.

Clock Code Description Range
H Hour in 24-hour format 00 .. 23
I Hour in 12-hour format 01 .. 12
k Hour in 24-hour format, without leading zero 0 .. 23
l (lowercase-L) Hour in 12-hour format, without leading zero 1 .. 12
M Minute 00 .. 59
p AM or PM AM .. PM
r Time, 12-hour format 00:00:00 AM .. 11:59:59 PM
R Time, 24-hour format (no seconds) 00:00 .. 23:59
s Seconds since 1970-01-01 00:00:00 UTC 0 .. 4294967295
S Second 00 .. 59
T Time, 24-hour format (with seconds) 00:00:00 .. 23:59:59


Date Codes

The following date codes can be used to display various components of dates.

Clock Code Description Range
a Abbreviated weekday name Sun .. Sat
A Full weekday name, variable length Sunday .. Saturday
b Abbreviated month name Jan .. Dec
B Full month name, variable length January .. December
c Date and time Sat Jun 21 22:52:10 2003
C Century 20
d Day of month 01 .. 31
D Date (mm/dd/yy) 01/01/00 .. 12/31/99
e Day of month 1 .. 31
h Same as %b, Abbreviated month name Jan .. Dec
j Day of year 001 .. 366
m Month 01 .. 12
q Quarter 1 .. 4
(1=Jan/Feb/Mar; 2=Apr/May/Jun; 3=Jul/Aug/Sep; 4=Oct/Nov/Dec)
u Day of week (with 1 corresponding to Monday) 1 .. 7
U Week number of year (week number 1 has 1st Sunday) 00 .. 53
V Week number of year (Monday as first day of week) 01 .. 52
w Day of week with 0 corresponding to Sunday 0 .. 6
W Week number of year (week number 1 has 1st Monday) 00 .. 53
x Same as %D, Date (mm/dd/yy) 01/01/00 .. 12/31/99
y Last two digits of year (yy) 00 .. 99
Y Year (yyyy) 1970 ..


Script Parameters Supported

The following script parameters can contain clock codes.

Script Parameter Example Example Result Example Meaning
asinsearch asinsearch=week%W asinsearch=week23 Use this week's week number as the value of the asinsearch parameter. In this example, the file week23.txt (if it exists) is read for a list of ASIN's. Thus you could automatically display a different list of products each week.
exclude exclude=%b exclude=jun Use this month's abbreviated name (Jan, Feb, ..., Dec) as the value of the exclude parameter. Thus a different exclude file will be selected each month.
format format=%a format=fri Use today's abbreviated date (Sun, Mon, ..., Sat) as the value of the format parameter. Thus a different format file will be selected each day.
template template=page%q template=page2 Use this quarter's number as part of the value of the template parameter. Thus a different template file is selected for each quarter of the year.
upcsearch upcsearch=week%W upcsearch=week23 Use this week's week number as the value of the upcsearch parameter. In this example, the file week23.txt (if it exists) is read for a list of UPC's. Thus you could automatically display a different list of products each week.



Configuration Variables Supported

The following configuration variables can contain clock codes.

Configuration Variable Example Example Result Example Meaning
asinsearch.format asinsearch.format "%a" asinsearch.format "fri" Use today's abbreviated date (Sun, Mon, ..., Sat) as the value of the asinsearch.format variable. Thus a different format file will be selected each day to display product details pages.
exclude.file exclude.file "%b" exclude.file "jun" Use this month's abbreviated name (Jan, Feb, ..., Dec) as the value of the exclude.file variable. Thus a different exclude file will be selected each month.
format format "%a" format "fri" Use today's abbreviated date (Sun, Mon, ..., Sat) as the value of the format variable. Thus a different format file will be selected each day.
template template "page%q" template "page2" Use this quarter's number as part of the value of the template variable. Thus a different template file is selected for each quarter of the year.




< Previous Table of Contents Next >




E.&O.E.; © Cusimano.Com Corporation; www.c3scripts.com