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 8849539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:40:44+00:00 2026-06-14T12:40:44+00:00

i got problem with my LINQ to format date. Here is code var resultCustomer

  • 0

i got problem with my LINQ to format date. Here is code

 var resultCustomer = from row in formDg.dtCustomer.AsEnumerable()
                          where row.Field<int>("customerID") == customerID2
                          select new
                          {
                              name = row["customerName"].ToString(),
                              ic = row["customerIC"].ToString(),
                              add1 = row["customerAdd1"].ToString(),
                              add2 = row["customerAdd2"].ToString(),
                              tel = row["customerTel"].ToString(),
                              tel2 = row["customerTel2"].ToString(),
                              tel3 = row["customerTel3"].ToString(),
                              email = row["customerEmail"].ToString(),
                              dateRegister = row["customerDateRegister"].ToString(),
                              customerRef = row["customerRef"].ToString(),
                              customerGroup = row["groupCustName"].ToString(),
                              panelName = row["panelName"].ToString(),
                              };

var firstRecord = resultCustomer.First();// My record return single row only

My question is how i can format custom date like “dd/MM/yyyy” in customerDateRegister?, Because I got problem when my textbox show 16-Nov-12 12:00:00 AM. I don`t want to display time but just date only.

I have try like this tbDateRegOv.Text = firstRecord.dateRegister.ToString(“dd/MM/yyyy”);. not work. Then i try dateRegister = row[“customerDateRegister”].ToString(“dd/MM/yyyy”), in LINQ. Same problem.

So how can I solved this problem? Thanks for help. 🙂

  • 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-14T12:40:46+00:00Added an answer on June 14, 2026 at 12:40 pm

    You need to cast your row as a DateTime first. This will allow you to use the custom format strings for dates.

    dateRegister = ((DateTime)row["customerDateRegister"]).ToString("dd/MM/yyyy")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got a problem with this linq query: from PersistedFileInfo fi in m_Database from
I want to ask about strcpy. I got problem here. Here is my code:
I'm having a problem with LINQ var operations = (from c in dCAPPEntities.CIC_OPERAZIONI where
I've got a problem with Linq in VB.NET. I've created a .dbml file from
i`ve got a little problem with LINQ. I read out some information via XML-RPC.
I'm really a LINQ newbie. I got an unknown problem: public static int save(TEntity
i got problem with my code and hopefully someone able to figure it out.
I've got problem for my application. I want to start connectbot from my application
have a nice day. I got problem when trying to create an image from
I've got a LINQ problem thats got me a little stumped. I can see

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.