cancel
Showing results for 
Search instead for 
Did you mean: 

Create timestamp including milliseconds

Roberto_LuisRod
Level 3
Hello!
I am trying to create a timestamp including milliseconds with the following expression:
FormatDateTime(Now(), "yyyy_MM_dd_hh_mm_ss_fff")
According to the Dot.Net documentation (https://docs.microsoft.com/de-de/dotnet/standard/base-types/custom-date-and-time-format-strings) it should work with fff. Unfortunately I only get 000 at the end, which is unlikely to be correct considering the number of attempts I already made.
What should the format string be so that the milliseconds are part of the result?
PS: FFF instead of fff does not work either.
Thanks a lot!
#BPTechTips
​​

------------------------------
Roberto Luis Rodríguez Estévez
Senior Software Developer
Expleo Technology Germany GmbH
Europe/Berlin
------------------------------
1 BEST ANSWER

Best Answers

Hi Roberto,

Please do below things

1.add namespace and dll in initial stage
Namespace:
Microsoft.VisualBasic
Assembly:
Microsoft.VisualBasic.Core.dll

2.Please use code stage with below code (MS will be string as output)

Dim MS 
MS = format(Now,"yyyy_MM_dd_hh_mm_ss_fff")

You can build code  here without installing .net (https://www.tutorialspoint.com/compile_vb.net_online.php)

I hope your issue is resolve now.

thanks

------------------------------
Nilesh Jadhav
Senior RPA Specialist
ADP
India
------------------------------
Nilesh Jadhav.
Consultant
ADP,India

View answer in original post

4 REPLIES 4

Hi Roberto,

Please do below things

1.add namespace and dll in initial stage
Namespace:
Microsoft.VisualBasic
Assembly:
Microsoft.VisualBasic.Core.dll

2.Please use code stage with below code (MS will be string as output)

Dim MS 
MS = format(Now,"yyyy_MM_dd_hh_mm_ss_fff")

You can build code  here without installing .net (https://www.tutorialspoint.com/compile_vb.net_online.php)

I hope your issue is resolve now.

thanks

------------------------------
Nilesh Jadhav
Senior RPA Specialist
ADP
India
------------------------------
Nilesh Jadhav.
Consultant
ADP,India

ewilson
Staff
Staff
This works for me:

DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss_fff");​

Here's a screenshot of returning that in an output data item (of type Text) in a code stage:

23068.png


------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Thanks to @ewilson and @Nilesh Jadhav: Your both did it! Now it works fine. Thanks!

Remark: @Nilesh Jadhav: I ommit the (re) definition of MS because MS is already defined as output.

------------------------------
Roberto Luis Rodríguez Estévez
Senior Software Developer
Expleo Technology Germany GmbH
Europe/Berlin
------------------------------

Hi @Roberto Luis 

its great news and really happy as you got output​​ 🙂

Thanks
Nilesh

------------------------------
Nilesh Jadhav
Senior RPA Specialist
ADP
India
------------------------------
Nilesh Jadhav.
Consultant
ADP,India