Add leading zeroes to integer


#1 framold

You can get microseconds of an DateTime object:

integer microsecond(datetime datetime)
    Return the microsecond part of the time value.

Since this a fraction of a second want it to log:

 second($EventTime) + "." + microsecond(($EventTime)

However this is wrong, when the microseconds fraction is lower then 100000. I need to add leading zeroes.

How do i do this?

Note: I cannot use sprintf("%06d", val) in perl module, since i am on windows.

#2 b0ti Nxlog ✓
#1 framold
You can get microseconds of an DateTime object: integer microsecond(datetime datetime) Return the microsecond part of the time value. Since this a fraction of a second want it to log: second($EventTime) + "." + microsecond(($EventTime) However this is wrong, when the microseconds fraction is lower then 100000. I need to add leading zeroes. How do i do this? Note: I cannot use sprintf("%06d", val) in perl module, since i am on windows.

You could probably use the strftime() function.