troubleshooting Question

Reverse date

Avatar of Peter Kiers
Peter KiersFlag for Netherlands asked on
Delphi
4 Comments1 Solution436 ViewsLast Modified:
Dear Experts,

I have a Button, a ListView and a XMLDocument-component on my form.
I have put the Button1Click procedure in the code-section. When I press
on the button it uses the XMLDocument-component to parse the xml-file
that is specified in the procedure. It searches for the nodes that begins with 'BG'  
and displays from every node that begins with BG the values from Val, Dt and TM
into the Listview columns Value, Date and Time.

AND IT WORKS SUPER.

Only the date in the xml file is displayed like this: 2010-06-09
So I get this in the column date too. Is there a way to reverse
the date like this: 09-06-2010.

If you don't know what I mean. I have allready asked this question but then
I had a ClientDataset instead of a Listview.

https://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_26280595.html

Is that possible? I hope someone knows the answer and is willing to help me.

Greetings,
Peter Kiers
procedure TForm1.Button1Click(Sender: TObject);
var
  LoopNodes : IDOMNodeList;
  i: Integer;
begin
  XMLDocument1.FileName := '.\MyDB.xml';
  XMLDocument1.Active := True;
  try
    LoopNodes:= XMLDocument1.DOMDocument.getElementsByTagName( 'BG' );

    ListView1.Items.BeginUpdate;
    try
      for i:= 0 to LoopNodes.length -1 do
        with ListView1.Items.add do begin
          Caption:= LoopNodes[i].attributes.getNamedItem('Dt').nodeValue;
          SubItems.Add( LoopNodes[i].attributes.getNamedItem('Tm').nodeValue );
          SubItems.Add( LoopNodes[i].attributes.getNamedItem('Val').nodeValue );
        end;
    finally
      ListView1.Items.EndUpdate;
    end;

  finally
    XMLDocument1.Active := False;
  end;
end;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros