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

  • SEARCH
  • Home
  • 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 7185873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:30:43+00:00 2026-05-28T18:30:43+00:00

I am pulling a date out of a database and it is a varchar.

  • 0

I am pulling a date out of a database and it is a varchar. However in the database it is formatted Y/M/D/. I need it to render on the front end a D/M/Y. I am bring it into Linq using Entity framework. It looks like this:

var startdateParam = new ObjectParameter(“StartDate”, typeof (string));

I then call the stored procedure:

  var webinarProducts = mgr.GetWebinars(groupCodeParam, startdateParam).ToList();

I then assign it to my product list:

webinar.StartDate = startdateParam.Value.ToString();

Finally, in the cshtml file ( I am building this in MVC3) I display like this:

  • @Model.StartDate
  • But when I publish the page it just formats as the wierd date inside the Data table Y/M/D.

    I’ve tried to convert/parse/format this all over my code but I keep getting errors. What’s the best way to convert this to whatever date format I would like?

    • 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-05-28T18:30:44+00:00Added an answer on May 28, 2026 at 6:30 pm

      Use built-in parsing?

      http://msdn.microsoft.com/en-us/library/w2sa9yss.aspx

      Format strings here: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

      webinar.StartDate = DateTime.ParseExact(startdateParam.Value.ToString(), "yyyy/MM/dd", CultureInfo.InvariantCulture);
      

      Then in the front end you can specify

      @Model.ToString("dd/MM/yyyy")
      
      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    Im pulling a date from a database which is formatted like dd-mm-YYYY. What I
    I'm pulling back a Date and a Time from a database. They are stored
    I'm pulling a row from a database and there is a date field (y-m-d).
    I need to find out how many days in between two date ranges. The
    I'm pulling stock-quotes from Yahoo into a named tuple using the CSV module. YahooQuote
    I am pulling a date value from my database: Dim qfresho = From p
    I am pulling dates out of an Oracle database. They are set on a
    Basically just pulling a date out in YYYYMMDD and I can do this fine
    I have markup stored in a database, which I am pulling out and placing
    I am pulling data from Twitter's API and the return date is UTC in

    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.