Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:41:32+00:00 2026-06-06T00:41:32+00:00

I need to reformat a string containing a date without using code behind. The

  • 0

I need to reformat a string containing a date without using code behind. The string is in the form YY/MM/DD but needs to be MM/DD/YYYY. I have seen this done given a Date object, however I am limited because it is a string.

So far it seems that I need code behind to do this but at the moment that is unsupported from our vendor.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:41:33+00:00Added an answer on June 6, 2026 at 12:41 am

    Since the question was asked about XAML-only string formatting, here is how you would specifiy the StringFormat in your XAML:

    Simple:

    StringFormat=d
    

    Longhand: (note the escape curly brackets)

    StringFormat='\{0:d\}'
    

    Custom: (added text)

    StringFormat='The date is \{0:d\}'
    

    A whole TextBox using a StringFormat:

    <TextBox Text="{Binding myProperty, StringFormat='The date is \{0:d\}'}"
    

    The syntax is the same as String.Format; however:

    • You can only use one parameter
    • You have to escape curly braces with a backslash
    • If you want to specify more than just the format string, you have to put the whole expression in single quotes

    All that being said, what you are trying to do is not simply format a date, but rather you are trying to parse a string as a DateTime, then format that DateTime as a string. Of those two steps, only the later can be done in XAML. It’s sad times, but after all, XAML is for markup, not computation.

    On the bright side, if you have the ability to reference another assembly in your project, you can implement an IValueConverter, which will give you the ability to convert the input string to a DateTime, then the StringFormat in XAML would work. Alternatively, your IValueConverter could just export the date in the specified format.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to reformat a string using jQuery or vanilla JavaScript Let’s say we
I need to reformat my machine but I have so many user/passwords stored in
I have some markup here that I need to reformat using javascript. Basically, I
Need some regular expressions help. So far I have my code working to allow
I have a date string which looks like this: Thu Feb 09 2012 01:50:00
I need to reformat the function below in the form of an jQuery.ajax call
I have a file that I need to reformat and remove extra blank lines.
I have to reformat a string that can contain the following : $string =
I need to reformat a text file into a PDF. Using Perl, I am
So I basically need to reformat a BUNCH of HTML. The editor I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.