How to print minutes using DateFormat
Hi,
I am attempting to print the minutes field in a DateTimeData object using DateFormat.
I am using the following code:
dtd : DateTimeData = new();
dtd.SetValue('25-Jan-2007 15:45:58');
df : DateFormat = new();
df.Template = 'mm';
td : TextData = df.FormatDate(dtd);
task.part.logmgr.putline(td);
I am getting an output of 01 instead of 45. The help file states that month and minutes have the same template of 'mm'. How can I print just the minutes field?
Thanks for your help.
- JJ
Yep ... a bit anoying they did not think of MM for months and mm for minutes if there aren't any hh or ss to tell what mm stands for mm is always the month.
here is a workaround.
Cheers,
dtd : DateTimeData = new();
dtd.SetValue('25-Jan-2007 15:05:58');
nf : NumericFormat = new(template = '00');
nd : IntegerData = new(integervalue = dtd.GetUnit(DR_MINUTE,TZ_LOCAL));
td : TextData = nf.FormatNumeric(nd);
// if leading zero needed
task.part.logmgr.putline(td);
//if not needed. remove the crap of nf & nd.
task.part.logmgr.putline(dtd.GetUnit(DR_MINUTE,TZ_LOCAL));