c#


How to format a DateTime inside of List using WebApi Entity Framework


I have a Property
[DataType(DataType.Date)]
public DateTime? DatePost { get; set; }
And I want to format the DateTime for each item of this property.
Select(x => new
{
x.Price,
x.ItemsCount,
x.DatePost});
var result = query.toList();
So I was trying to use a foreach to get each property and change to ShortDateString, but the result of query it always come with the time together. The format has to be like this "dd/MM/yyyy".
List<dynamic> l = new List<dynamic>();
var result = users.ToList();
foreach (var item in result)
{
item.DatePost?.ToShortDateString();
l.Add(item);
}
return Ok(l);
The result is :
2017-04-15T23:53:00.193

Related Links

How to insert numbers from line into array in Collection
Don't show read only dialog when opening a word document
Does PLINQ really not preserve order?
How do I correlate a Linq query extension method to its signature in the documentation?
Datagridview event not firing
How do I redistribute Microsoft.AnalysisServices.SPClient.Interfaces
Get Standard Touchpad Swipe
How to calculate the sum of the datatable column in c#
System.ArgumentException “Parameter is not valid” when comparing image dimensions
Set field via class
how to use ModelState.IsValid in ASP.NET?
protobuf-net : v2 deserialize v1 objects with inheritance
Getting data on ListView Select event and setting it in a div in C#
c# Oledb add list of parameters in a foreach loop
dotnet ef not works with ef tools 1.1.0-preview4-final
Check permission of a PDF using itext [duplicate]

Categories

HOME
postgresql
ckan
system-calls
ns2
display
skypedeveloper
crm
azure-resource-manager
singleton
sms
localhost
comments
rethinkdb
osx-yosemite
token
google-app-maker
aspectj
solidity
logstash-configuration
udeploy
glibc
keystone
gomobile
combinations
lotusscript
mattermost
csproj
recreate
directions
availability
aweber
ragel
android-databinding
outlook-2010
anypoint-studio
lex
latency
vertical-alignment
android-graphview
autodesk-data-management
superclass
html-entities
amazon-fire-tv
spring-ide
mef
webmatrix
chain
rmq
acceleo
distcc
scikit-image
camellia
dcast
dynamics-nav-2013
identifying
vensim
euro
fileinputstream
data-representation
skview
backtrace
frisby.js
qf-test
tigase
sat4j
xts
ccmenuitem
visual-studio-setup-proje
acrofields
google-oauth-java-client
dylan
grape-api
blotter
rfc822
motordriver
derived-class
xcode4.6.3
blackberry-eclipse-plugin
nserror
object-tag
functional-specifications
designated-initializer
cryptolicensing
database-agnostic
silverlight-2.0
qprocess
uccapi

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App