Format date equivalent

Posted on 2004-11-22
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

    Something like:

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

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now