Note that there are some explanatory texts on larger screens.

plurals
  1. POdatetime display issue from webservice
    text
    copied!<p>Im having diffculty with datetime when its displayed client side from my rest web service, my client side wpf app code looks like this:</p> <pre><code> public MainWindow() { InitializeComponent(); string uriGroups = "http://localhost:8000/Service/Student"; XDocument xDoc = XDocument.Load(uriGroups); foreach(var node in xDoc.Descendants("Student")) { GroupBox groupbox = new GroupBox(); groupbox.Header = String.Format(node.Element("StudentID").Value); groupbox.Width = 100; groupbox.Height = 100; groupbox.Margin = new Thickness(2); TextBlock textBlock = new TextBlock(); textBlock.Text = String.Format(node.Element("FirstName").Value + " " + (node.Element("LastName").Value)); textBlock.TextAlignment = TextAlignment.Center; TextBlock textBlock1 = new TextBlock(); textBlock1.Text = String.Format(node.Element("TimeAdded").Value); textBlock1.TextAlignment = TextAlignment.Center; textBlock1.VerticalAlignment = VerticalAlignment.Bottom; StackPanel stackPanel = new StackPanel(); stackPanel.Children.Add(groupbox); stackPanel.Children.Add(textBlock); stackPanel.Children.Add(textBlock1); stackPanel.Margin = new Thickness(10); MainArea.Children.Add(stackPanel); } } </code></pre> <p>And my service looks like this:</p> <pre><code>public class Student { .... public DateTime TimeAdded; public string TimeAddedString { get { return this.TimeAdded.ToString("dd/MM/yyyy hh:mm:ss"); } } </code></pre> <p>But the output looks like this:</p> <p><img src="https://i.stack.imgur.com/gri25.jpg" alt="enter image description here"></p> <p>Is there a way on my client side app code to truncate this or reformat it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload