Friday, April 17, 2015

Linq Convert DateTime? to DateTime in ("dd/MM/yyyy")

Sql Query:
SELECT convert(varchar,[addedat],103) as addedat FROM tblTable


Linq Query:

 var query = from q in entity.tblTable
                    select new
                    {
                     
                        date = SqlFunctions.DateName("day", q.addedat).Trim() + "/" +
                            SqlFunctions.StringConvert((double)q.addedat.Value.Month).TrimStart() + "/" +
                            SqlFunctions.DateName("year", q.addedat),
                    };

2 comments:

  1. Linq convert is very interesting. This is more helpful.

    Convert ASP to ASP.Net

    ReplyDelete
  2. You should see how my friend Wesley Virgin's tale starts with this SHOCKING and controversial VIDEO.

    As a matter of fact, Wesley was in the army-and shortly after leaving-he discovered hidden, "self mind control" secrets that the government and others used to obtain whatever they want.

    These are the EXACT same SECRETS lots of famous people (especially those who "come out of nowhere") and top business people used to become wealthy and successful.

    You probably know how you use less than 10% of your brain.

    Really, that's because most of your brainpower is UNCONSCIOUS.

    Perhaps this expression has even occurred INSIDE OF YOUR own mind... as it did in my good friend Wesley Virgin's mind about seven years back, while driving an unlicensed, beat-up trash bucket of a car without a license and $3.20 on his debit card.

    "I'm absolutely frustrated with living payroll to payroll! When will I finally succeed?"

    You've taken part in those thoughts, am I right?

    Your success story is waiting to happen. Go and take a leap of faith in YOURSELF.

    UNLOCK YOUR SECRET BRAINPOWER

    ReplyDelete