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

[563 byte] By [JohnJacobsa] at [2007-11-14]
# 1

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));

Fortevera at 2007-7-9 > top of java,Application & Integration Servers,Integration Servers...
# 2
Thanks for the quick answer...Yes - it's really interesting that they did not use a different template for minutes. After all, the template is case-sensitive - so using MM would not have impacted the month template.- JJ
JohnJacobsa at 2007-7-9 > top of java,Application & Integration Servers,Integration Servers...