[QGIS-Developer] format_date() expression function and milliseconds

Raymond Nijssen r.nijssen at terglobo.nl
Wed Feb 19 05:47:00 PST 2020


I'm trying make a label showing milliseconds and wonder if QGIS handles 
these correctly.


The docs say:

z: the milliseconds without leading zeroes (0 to 999)
zzz: the milliseconds with leading zeroes (000 to 999)

I think the docs should say 'with/without **trailing** zeroes.


Here some examples:

format_date('2012-05-15 01:23:45.000', '.zzz  .z') --> '.000  .0'
format_date('2012-05-15 01:23:45.001', '.zzz  .z') --> '.001  .001'
format_date('2012-05-15 01:23:45.010', '.zzz  .z') --> '.010  .01'
format_date('2012-05-15 01:23:45.100', '.zzz  .z') --> '.100  .1'



Should I change the docs? Or am I wrong?

BTW, the option 'without leading zeroes' does not exist and could be 
useful. Of course you can use to_string(to_int()) here but it is less 
convenient.


Kind regards,
Raymond


More information about the QGIS-Developer mailing list