web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

How to use only Date from Datetime field?

(0) ShareShare
ReportReport
Posted on by 15

Hi Everyone,

I am trying to use only Date from the DateTime field ("Created on" field). I am using the below C# code:

"string date = targetEntity.FormattedValues["createdon"].ToString();"

But it is giving the time also along with the date, how can I remove the time or how can I fetch only the date?

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Tarun,

    You can use DateTime.ParseExact(string s, string format, IFormatProvider? provider) to convert into a date-only format.

    (+) C# code to convert string to date without time - Microsoft Dynamics CRM Forum Community Forum

  • Tarun Ramawat Profile Picture
    15 on at

    Thank you, Leah Ju.

  • Community Member Profile Picture
    on at

    Hi Partner,

    Can you click Yes under "Did this answer your question?" to close this thread if my answer is helpful.

     pastedimage1639729611582v1.png

    Thanks in advance!:)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
FSRon Profile Picture

FSRon 23

#2
James White Profile Picture

James White 21

#3
AT-28040446-0 Profile Picture

AT-28040446-0 18

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans