Some things in pdox get done so often it becomes second nature.
Other times, one sits and thinks, how the heck did I do that last time ?
Then, you must search for an example, or just figure it out again.
I am not sure how many times I have had to go into the help screen
and lookup the format specs.
After way too many trips to the help screen for the format command,
I finally got around to making a quick cheat sheet for myself.
and figured I would post it here as a community reference table.
Obviously there are many different ways to do this,
and I did not include all - but it is a starting point.
Lets take todays date , 2/14/2008,
and using the format command,
we can format that many, many different ways.
I will show two examples :
YYYYMMDD or YYYYMM
var
daVal date
stVal string
endvar
daVal = date("2/14/2008")
; to get YYYYMMDD or 20080214
stVal = format("DY3M2D2O(%Y%M%D)",daVal)
stVal.view("YYYYMMDD")
or
; to get YYYYMM or 20080214
stVal = format("DY3M2O(%Y%M)",daVal)
stVal.view("YYYYMM")
So that spells out two examples,
and the others are posted below.
Perhaps next time someone tries to remember one of these,
they can just google this page and cut and paste from here.
If there are any settings for windows or international
that affect these, I am not aware of them at this time,
and so I am not aware if/when your mileage may vary.
Robert Wilt****re
For the date of : 2/14/2008
daVal = date("2/14/2008")
stVal = format("DM1",daVal)
Spec Shorthand FormattedString
------ ----------- -----------------
DM1 m/dd/yy 2/14/08
DM2 mm/dd/yy 02/14/08
DM3 Mon/dd/yy Feb/14/08
DM4 Month/dd/yy February/14/08
DD1 mm/d/yy 02/14/08
DD2 mm/dd/yy 02/14/08
DY1 mm/dd/y 02/14/8
DY2 mm/dd/yy 02/14/08
DY3 mm/dd/yyyy 02/14/2008
D1 mm/dd/yy 02/14/08
D2 Monthname dd, yyyy February 14,2008
D3 mm/dd 02/14
D4 mm/yy 02/08
D5 dd-Mon-yy 14-Feb-08
D6 Mon yy Feb 08
D7 dd-Mon-yy 14-Feb-2008
D8 mm/dd/yyyy 02/14/2008
D9 dd.mm.yy 14.02.08
D10 dd/mm/yy 14/02/08
D11 yy-mm-dd 08-02-14
DY3M2O(%Y%M) YYYYMM 200802
DY3M2D2O(%Y%M%D) YYYYMMDD 20080214
DY3M2D2O(%Y/%M/%D) YYYY/MM/DD 2008/02/14
DY3M2D2O(%Y-%M-%D) YYYY-MM-DD 2008-02-14
DD2O(%D) DD 14
DM2O(%M) MM 02
DY2O(%Y) YY 08
DY3O(%Y) YYYY 2008


|