LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying 2 digit year

  I need to display the date and time from a string of data I have of hex numbers(hh:mm:ss  mm/dd/yy).  I received each section of the data in an integer array.  The problem is that when any of the data is less than 10, it only displays it as 5 for example.  Where as I need it to display 05, I assume this is possible but not sure how.
 
// Update Read Time
sprintf(ctemp,"%d:%d:%d  %d/%d/%d",RxPacket[6],RxPacket[7],RxPacket[8],RxPacket[4],RxPacket[3],RxPacket[5]);
 
Thanks.
0 Kudos
Message 1 of 2
(2,956 Views)
  I found the answer I kept only putting %2d, but I needed to put %2.2d.
0 Kudos
Message 2 of 2
(2,952 Views)