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

Announcements

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 51 Super User 2026 Season 1

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 51 Most Valuable Professional

#3
Nagaraju_Matta Profile Picture

Nagaraju_Matta 50

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans