![]() |
Associate Engine : Clock Codes | |
| Home > Associate Engine > Documentation > 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} | |
| {date %I:%M %p} | 10:32 PM |
The following time codes can be used to display various components of time.
| Clock Code | Description | Range |
| H | Hour in 24-hour format | |
| I | Hour in 12-hour format | |
| k | Hour in 24-hour format, without leading zero | |
| l (lowercase-L) | Hour in 12-hour format, without leading zero | |
| M | Minute | |
| p | AM or PM | |
| r | Time, 12-hour format | 00:00:00 AM .. |
| 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) |
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 | |
| b | Abbreviated month name | Jan .. Dec |
| B | Full month name, variable length | |
| c | Date and time | |
| C | Century | 20 |
| d | Day of month | 01 .. 31 |
| D | Date (mm/dd/yy) | |
| 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) | |
| y | Last two digits of year (yy) | 00 .. 99 |
| Y | Year (yyyy) | 1970 .. |
The following script parameters can contain clock codes.
| Script Parameter | Example | Example Result | Example Meaning |
| asinsearch | 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 | 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 | 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 | 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 | 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. |
The following configuration variables can contain clock codes.
| Configuration Variable | Example | Example Result | Example Meaning |
| asinsearch.format | 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 | 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 | 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 | 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