Format date equivalent

Posted on 2004-11-22
Medium Priority
Last Modified: 2010-08-05
Hi Experts,

I have this in VB :

varSubEndDate = Format(DateAdd("m", adoProfile("sublendte") - 1, adoProfile("substartdte")), "mmmm yyyy")

I am getting instead of ado.... data from dr.ItemArray[10] and dr.ItemArray[11] respectively.

How will C# code look like :

string subenddte = Format(DateAdd("m", (dr.ItemArray[10]) - 1, (dr.ItemArray[11])), "mmmm yyyy"); ?

Thank you.
Question by:fpoyavo
1 Comment
LVL 16

Accepted Solution

muzzy2003 earned 2000 total points
ID: 12649939
Something like:

string subenddte = DateTime.Parse(dr.ItemArray[11]).AddMonths((int)(dr.ItemArray[10]) - 1).ToString("MMMM yyyy");

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question