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

Why is ExecuteReader only giving me 1 row of data back?
Why use a public method in an internal class?
WCF service installation and verification in IIS and/or WAS
Accessing data within MS Access database from visual studio C# Code
Modifying Databound ComboBox at run time
C# form with Javascript
advise on adding events in the object constructor
Datarelation with ultragrid
Non-blocking Sockets vs BeginXXX vs SocketAsyncEventArgs
MVVM viewmodel events (commands?)
Powershell nothing returned from C#, same code runs in ps prompt with \r\n's removed
How do I change the foreground text color of (local variable '…' is never used) in code
HttpHandler to render a png from an array of bytes
MVC Default Area Not working
Index (zero based) must be greater than or equal to zero and less than the size of the argument list [closed]
Sprite Targeting

Categories

HOME
asp.net
http
skype-for-business
cluster-analysis
weblogic
ebay-api
terminal
docker-compose
travis-ci-cli
gnuradio
install
handlebars.js
subprocess
mongoimport
kairosdb
websharper
http-status-codes
drush
watson-dialog
javascript-debugger
sha1
web-testing
game-engine
google-street-view
autologin
project-structure
openoffice-basic
restructuredtext
turn.js
ithit-webdav-server
workflow-foundation
azure-table-storage
arp
ibm-bpm
jql
visual-studio-debugging
slim-lang
qt-designer
ansible-inventory
ragel
javafxports
kofax
pygraphviz
autodesk-data-management
ocpjp
weld
azure-data-catalog
xmldom
easyquery
spring-cloud-bus
htop
reloaddata
dynatable
zedgraph
node.js-client
cardview
mavlink
netlink
hoare-logic
bytearray
jde
usps
camellia
paypal-subscriptions
stdlist
fadein
instabug
askbot
dynamics-nav
wiql
jcomponent
producer-consumer
windows-kernel
pushwoosh
borland-c++
tidesdk
mergecursor
sicstus-prolog
accpac
jad
fedena
frisby.js
novell
disparity-mapping
mvcgrid
debuggervisualizer
connections
dylan
oc4j
gmail-imap
mmo
freeimage
databus
optimistic-concurrency
wxperl
helicontech
facebook-winjs-sdk
execjs
cpack
viewdata
dongle
atmega16
urlscan

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