How to format DateTime?
RazgrizHsu opened this issue · comments
Raz commented
I would like to ask if there is a way to format as a string?
like ..
let now = Local::now().format( "%Y%m%d %H%M%S%.f" );
thanks you :)
Raz commented
Or can you point me how can I pad 6 decimal places after nano seconds,
Because when use format!( "{:29}", now )
the 2022-10-24 13:22:47.977840
will be 2022-10-24 13:22:47.97784
missing last zero
thank you
zxj commented
Or can you point me how can I pad 6 decimal places after nano seconds, Because when use
format!( "{:29}", now )
the2022-10-24 13:22:47.977840
will be2022-10-24 13:22:47.97784
missing last zerothank you
This is a no time zone design。
format you can use
format!( "{}-{}-{}T{}:{}:{}", now.year,now.mon,now.day,now.hour,now.min,now.sec)
Raz commented
Got it,
Thank you very much :)
zxj ***@***.***> 於 2022年10月24日 週一 13:43 寫道:
… Or can you point me how can I pad 6 decimal places after nano seconds,
Because when use format!( "{:29}", now ) the 2022-10-24 13:22:47.977840
will be 2022-10-24 13:22:47.97784 missing last zero
thank you
This is a no time zone design。
format you can use
format!( "{}-{}-{}T{}:{}:{}", now.year,now.mon,now.day,now.hour,now.min,now.sec)
—
Reply to this email directly, view it on GitHub
<#3 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5VP5LGR6OJWLDWTSZAA33WEYOXRANCNFSM6AAAAAARMUF7CU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>