I'm trying to convert this bit of Delphi code to C#:
Date1.Text:=FormatDateTime2('YYYY,JJJ/HHNNSS)
Which contains the year, the Julian day (with January 1st of each year being 1), and hours/minutes/seconds.
So an example for today would be 2016,054/090722
.
The FormatDateTime2
is a very, very long function with zero comments and unhelpful variable names in the delphi code, and I'd rather not spend a long time trying to convert that over.
Normally I would have something like this:
<TextBox Name="Date1" Text="{Binding Source={x:Static System:DateTime.Now}, Mode=OneWay, StringFormat='yyyy,JJJ/hhmmss'}" />
But the JJJ
day part doesn't work of course, because it isn't part of normal System.DateTime. Is there a simple way of doing this?