I have written a Named Expression that gets the date in its raw format (like this 05/10/2021 17:20:32). The expression uses the System.DateTime symbol set with the Now() function...
05/10/2021 17:20:32
System.DateTime
Now()
I'd like two more Named Expressions: one that returns just the formatted date (e.g. Oct 4, 2021) and one that returns just the formatted time (e.g. 5.10 pm). I've tried formatting unsuccessfully with System.String. What's the right way to go about formatting a date in a Named Expression?
System.String
This doc page demonstrates how to create an expression using System.DateTime.Now and System.String.Format symbols with the "dd", "MM", and "yyyy" formatting codes. https://docs.bentley.com/LiveContent/web/MicroStation%20Help-v14/en/GUID-01972610-9CC4-A5A1-7338-64F95181B875.html
You can find a full list of .NET DateTime string formatting codes here: https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings
Some combination of those codes is almost certainly going to give you what you need.
.
Answer Verified By: Jon Summers