Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

how to convert string type into date time data type field CRM

(0) ShareShare
ReportReport
Posted on by 65

how i can convert a string to YYYYMMDDMMHHSSFFF dateandtime field

*This post is locked for comments

  • gdas Profile Picture
    gdas 50,089 on at
    RE: how to convert string type into date time data type field CRM

    Great ! Could you please close the thread by verifying helpful answer.

  • fariha Profile Picture
    fariha 65 on at
    RE: how to convert string type into date time data type field CRM

    Thanks Goutam,

    after splitting string into years,day,month,hrs,min,sec using sub-string function i convert the string pattern into DateandTime in crm using

                   DateTime dt = new DateTime(Convert.ToInt16(year), Convert.ToInt16(month), Convert.ToInt16(day), Convert.ToInt16(hrs), Convert.ToInt16(min), Convert.ToInt16(sec), Convert.ToInt32(milisec));

    its worked absolutely fine for me.

  • Verified answer
    gdas Profile Picture
    gdas 50,089 on at
    RE: how to convert string type into date time data type field CRM

    Try with this -

    social.msdn.microsoft.com/.../convert-from-string-to-datetime

  • fariha Profile Picture
    fariha 65 on at
    RE: how to convert string type into date time data type field CRM

    Hi Pravin,

    Thanks for the reply actually i want to convert the value of string type field into date and time in plugin,

    DateTime.Now.ToString("yyyyMMddHHmmss"); this doesnt work for me

  • Suggested answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,231 on at
    RE: how to convert string type into date time data type field CRM

    Hi Fariha,

    Try this one:

    JS:

    var myStr = "19701029114010"; //your yyyymmddhhmmss value

    var date = new Date(myStr.replace(

       /^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/,

       '$4:$5:$6 $2/$3/$1'

    ));

    Plugin:

    DateTime.Now.ToString("yyyyMMddHHmmss");

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans