0

Using C# Functions in Dynamic Text to Format Dates

When configuring Dynamic text in bioWriter, It is possible to use C# functions.

For example, you could use C# functions to format a date or to convert it to a string.

 

In the example above, DateTime.Parse(Label(1,0,0)) will take a row label “January 2008” and convert it to 01/01/2008 00:00:00

Then, the date is formatted using the String.Format function.

Here are a couple more examples that might be useful:

To get the month name
String.Format("{0:MMMM}", DateTime.Parse(Label(1,0,0)))

To get last day of month
String.Format("{0:MMMM dd, yyyy}", DateTime_AddDays( DateTime_AddMonths( DateTime.Parse( Label(0,0,0)), 1), -1))

 

More information on the String.Format functions is available here:

https://msdn.microsoft.com/en-us/library/system.string.format(v=vs....

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 7 mths agoLast active
  • 1074Views
  • 1 Following