annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

time format

For a status report of the program, showing each command sended and the actions executed,  I want to introduce a time stamp at the beginning of each line
0 Kudos
Messaggio 1 di 7
4.208Visualizzazioni
I'm not sure about what exactely you're asking for...

If it's just about how to to get a date and time string then it's very easy... see attached picture.





We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Messaggio 2 di 7
4.205Visualizzazioni
I don´t know why, there are 2 messages created, one of them only with half text. Sorry about that. Here is the full one:
 
"For a status report showing each command sended and execution of the program, I want to add a time stamp in the beginning of each line of it. To obtain a more clear result, I want all characters in the same space, but I can´t achieve it due to the hour field, as shown in this example:
 
8:57:43 command example1
10:01:07 command example2 
 
I have seen how to remove the leading zeros (with #) from minutes and seconds, but not how to add it to the hour, which is what I´m looking for.
 
I know that there is another option: split the string, analyze the hour and add a initial space if is under 10, but it looks a quite dirty solution. So I guess it can be implemented with the time format string. Somebody knows how?
 
Thanks."
 
Gatet
0 Kudos
Messaggio 3 di 7
4.200Visualizzazioni
Well then sory, I can't answer the full question... I'd use the string functions to fix it... Maybe there's a better way.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Messaggio 4 di 7
4.197Visualizzazioni

Thanks anyway, Titou.

By the way, I get the solutionSmiley Molto-felice

 

0 Kudos
Messaggio 5 di 7
4.190Visualizzazioni

I see that this is an ancient thread but I'm having the same issue and the proposed solution does not work for me. I'm using a very similar format string (%H:%M:%S%2u) and it does not give me a leading zero for single-digit hours. Does anyone have a solution?

0 Kudos
Messaggio 6 di 7
3.671Visualizzazioni
0 Kudos
Messaggio 7 di 7
3.659Visualizzazioni