Convert string to date:
setvar=cdatum=<today,yyyy/mm/dd>
messagebox=<cdatum,date yyyymmdd> 23:30 => 20030201 23:30
More info see: format
Normally it is sufficient to use the date <mydate>
This returns the standard-format (depending on the language) without time.
These are the possible defaults for formatting:
date language-depending display and print
dbdate database-depending pass-on to the SELECT-command
Please do not use quotation marks
select * from ordr where docdate=<today,dbdate>
if the variable is format "datetime" then you've follow formats
userdate Date-Format current user
dayname Name of current Day in the language from current user
week Week-Number (system-calender), example 01, 02 ...
yearweek Year + Week, example 2012/41
time Time in current User-Format
datetime Date + Time in current User-Format
datetime ldt_date
ldt_date=<today>
messagebox=<ldt_date,dayname>
If you pass-on date values you should use the international formatting yyyy/mm/dd
datetime dt_parm1
dt_parm1=<today,yyyy/mm/dd>
Only this provides correct international functionality.
If you want to reduce the result of a SQL-command with a date, use str_parm.dt_parm1 / str_parm.dt_parm2. dt_parm2 always contains the time 24:00
Character Meaning
h Hour with no leading zero (for example, 1)
hh Hour with leading zero if appropriate (for example, 01)
m Minute with no leading zero (must follow h or hh)
mm Minute with leading zero if appropriate (must follow h or hh)
s Second with no leading zero (must follow m or mm)
ss Second with leading zero (must follow m or mm)
ffffff Microseconds with no leading zeros. You can enter one to six f's; each f represents a fraction of a second (must follow s or ss)
AM/PM Two-character, upper-case abbreviation (AM or PM as appropriate)
am/pm Two-character, lower-case abbreviation (am or pm as appropriate)
A/P One-character, upper-case abbreviation (A or P as appropriate)
a/p One-character, lower-case abbreviation (a or p as appropriate)
[time] The keyword [Time] tells PowerBuilder to use the time format specified in the Microsoft Windows control panel.
Usage
24-hour format is the default. Times display in 24-hour format unless you specify AM/PM, am/pm, A/P, or a/p.
Format Displays
h:mm AM/PM 9:45 PM
hh:mm A/P 09:45 P
h:mm:ss am/pm 9:45:33 pm
h:mm 21:45
h:mm:ss 21:45:33
h:mm:ss:f 21:45:33:2
h:mm:ss:fff 21:45:33:234
h:mm:ss:ffffff 21:45:33:234567
m/d/yy h:mm 1/30/03 21:45
message=<timefield,hh:mm:ss AM/PM>: 08:00:00 PM
The following table shows characters that have special meaning in date display formats.
Character Meaning Example
d Day number with no leading zero 9
dd Day number with leading zero if appropriate 09
ddd Day name abbreviation Mon
dddd Day name Monday
m Month number with no leading zero 6
mm Month number with leading zero if appropriate 06
mmm Month name abbreviation Jun
mmmm Month name June
yy Two-digit year 97
yyyy Four-digit year 1997
Colons, slashes, and spaces display as entered in the mask.
Format Displays
[red]m/d/yy 1/30/03
d-mmm-yy 30-Jan-03
dd-mmmm 30-January
mmm-yy Jan-03
dddd, mmm d, yyyy Friday, Jan 30, 2003
Example for datetime
message=<timestampfield,MMMM d yyyy hh:mm:ss AM/PM>: January 1 2006 08:00:00 PM
message=<timestampfield,MMMM d, yyyy HH:mm:ss AM/PM>: December 31, 2006 20:00:00 PM
for convert date in sql-statements work with format-string dbdate!
select * from mytable where date_id between <fromdate,dbdate> and <todate,dbdate>
write datetime-field
set a datetime-field with format yyyy/mm/dd hh:mm
Example:
dw_1.item.fromdate.value=<today,yyyy/mm/dd> <now,time>