How To Format Date Fields And Date Variables
Fine-tuning your date formats is a straight forward process.
Three basic characters are used:
'd' for Day. (lower case only)
'M' for Month. (upper case only)
'y' for Year. (lower case only)
These characters are used in different combinations
to tell Collect! how to format your date codes. They
are used in combination with the codes for Date, Week,
Month and Year. They do not retrieve date information,
they only format the date which your date code retrieves
or prints.
Day Formats
dd
|
01, 02, 03
|
ddd
|
Mon, Tue, Wed
|
dddd
|
Monday, Tuesday, Wednesday
|
Month Formats
MM
|
01, 02, 03
|
MMM
|
Jan, Feb, Mar
|
MMMM
|
January, February
|
Year Formats
yy
|
97, 98, 99, 00
|
yyyy
|
1997, 1998, 1999, 2000
|
Today's Date
@e
|
June 22, 2000
|
@d
|
06/22/2000
|
@d<MM dd yy>
|
06 22 00
|
@d<ddd MMM dd yy>
|
Thu Jun 22 00
|
@d<dddd MMMM dd yyyy>
|
Thursday June 22 2000
|
@d<dddd', 'MMMM dd', 'yyyy>
|
Thursday, June 22, 2000
|
Listed Date
This example uses the Debtor form to pull the Listed Date
of the Debtor record.
@de.li
|
06/20/00
|
@de.li<MM dd yy>
|
06 20 00
|
@de.li<ddd MMM dd yy>
|
Tue Jun 20 00
|
@de.li<dddd MMMM dd yyyy>
|
Tuesday June 20 2000
|
@de.li<dddd', 'MMMM dd', 'yyyy>
|
Tuesday, June 20, 2000
|
You can insert your own text within the date code string by
enclosing it in a pair of single quotes.
e.g @de.li<MMMM dd', 'yyyy'. This is a 'dddd'.'> will
result in "February 21, 2000. This is a Monday."
When using a new date format on any field, it is
only applied to the given field. Each field is able to define
how it is formatted.
Date With Text
If you intend to use a formatted date within your text body,
it is necessary to put the date into a variable first.
Example:
@varDate! = "01/01/2001"
@varDate2! = "01/01/2001"
@varDate = @d+7
@varDate2 = @d+14
From the above example -
If you include the @varDate in your text, it will print a date 7 days
from today's date. The @varDate2 will print a date 14 days hence.
Example 1:
This will print @varDate and this will print @varDate2 for example.
It will print as follows:
This will print 11/28/01 and this will print 12/05/01 for example. (In
this example, today's date was 11/21/01)
Example 2 with formatting:
This will print @varDate<dd MMM, yyyy> and this as well
And this will print @varDate2<dd MMM, yyyy> and this as well
It will print as follows:
This will print 28 November, 2001 and this as well
And this will print 05 December, 2001 and this as well
If you did not use a variable to hold your date, part of your
text ("and this as well" in the example) would be cut off.
For example:
This is a date @d<dd MMM, yyyy> And it is formatted
Will result in "And it is formatted" being cut off.
Example output:
This is a date 21 November, 2001
Put the date in quotes when you declare your variable
if specified as 01/01/2001. You don't need quotes if specified as 1010101.
Please see also How To Use Variables.
Date With No Separators
If you require the date without the separator [ / ] that Collect!
places between day / month / year, you can print each section
as a separate part and use the NO LINE FEED command to
keep them together.
Example 1:
Let's say you need the date to say yyyyymmdd with no separator. Try this:
@no line feed (This command is case sensitive.)
@de.li<yyyy>
@de.li<MM>
@de.li<dd>
@line feed (This command is case sensitive.)
This example prints the Debtor's Listed
date (Ex: January 7, 2011) as 20110107
Example 2:
Using variables gives you more flexibility:
@varYear* = @de.li<yyyy>
@varMonth* = @de.li<MM>
@varDay* = @de.li<dd>
@varStr* = @(varYear+varMonth+varDay)
This example prints the Debtor's Listed
date (Ex: January 7, 2011) as 20110107 whenever
you output @varStr.
Example 3:
You can also pad your results if needed for a special
electronic format.
@varStr2* = @varStr<010>
This example prints the Debtor's Listed
date (Ex: January 7, 2011) as 0020110107 whenever
you output @varStr2. This is the date value padded up
to 10 spaces.
Date Parsers
You can extract Month, Day or Year numbers out of a date
using Collect!'s special date parsers. These commands
are not for display, but are used to assign a portion of the
date to an integer.
Example:
For Debtor Listed Date: 05/30/2011
@varMonth# = @de.li<m>
@varMonth is now 05
@varDay# = <d>
@varDay is now 30
@varYear# = <y>
@varYear is now 2011
Assigning Formatted Date Fields To A Variable
You can also extract Day, Month or Year in any of the Date
formats shown above and assign this to a variable. This
works for any printable information Date field.
Example:
@varStr* = @de.li<MMMM>
If the Debtor's Listed is 02/21/2011 the @varStr now
holds "February."
Using Foreign Language Settings
You can display days and months in a foreign language. This
requires changes to settings in Collect! and changes to regional
settings in Windows. If the regional settings in Windows are
changed to those of another country, Collect! can display the
days and months in that country's language.
Refer to your Windows manual for instructions on changing your
regional settings.
Then, in Collect!, Choose System from the menu at the top of
your Collect! screen. From the drop-down menu, Choose Company
Details. The Company Details form is displayed. In the lower
right hand part of this form, you will see a check box
labeled " Multi Currency." Check this box to switch on the
multi- currency feature of Collect!.
Additional Formatting Codes For Dates
Any combination of day/month/year strings can be used in
your code. These codes can be used with date ranges. They
can also be used when adding or subtracting days from a
given date.
Dates are also used in advanced report design. You will find
references to them in How-to topics covering Lists and Loops,
Conditionals, Variables and Math topics. Remember to review the list of
pre-defined reports for examples. Also, Collect! Technical Services can build
custom reports for complex use of date ranges and pulling information for
reports. Refer to How To Order Custom Reports.
See Also
- How To Calculate Date Ranges in Reports and Letters
- How To Format Variables When Assigning
- Report Sample to view sample reports and letters
- Report Topics Index for a list of all report and letter topics
|
Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.
Please click this link to send us your comments: helpinfo@collect.org