Results 1 to 2 of 2

Thread: How do I get a dattime format in C# that will look like this:

  1. #1

    How do I get a dattime format in C# that will look like this:

    How do I get a dattime format in C# that will look like this:

    2011-09-01 00:00:00:000
    This works
    DateTime saveNow = DateTime.Now;

    string test = String.Format("{0:yyyy-MM-01 00:00:00:000}", saveNow);

    Now I want to know this. How would I subtract one month from the current month?

    It T-SQL it would look like this

    How would it be done in C#?


    trying the addmonth method with a negative one did not work

  2. #2
    Junior Member Mikerad's Avatar
    Join Date
    Jun 2002
    Posts
    48
    Quote Originally Posted by complete View Post
    How do I get a dattime format in C# that will look like this:

    2011-09-01 00:00:00:000
    This works
    DateTime saveNow = DateTime.Now;

    string test = String.Format("{0:yyyy-MM-01 00:00:00:000}", saveNow);

    Now I want to know this. How would I subtract one month from the current month?

    It T-SQL it would look like this

    How would it be done in C#?


    trying the addmonth method with a negative one did not work
    not sure if you ever got this answered or not, but DateTime.AddMonth(-1) returns a new date, so it will not affect saveNow. You'd need to write saveNow = saveNow.AddMonth(-1);

Similar Threads

  1. VLA format
    By 24giovanni in forum Software Forum
    Replies: 0
    Last Post: 06-15-08, 01:08 PM
  2. About to format . . .
    By fubarman in forum General Discussion Board
    Replies: 3
    Last Post: 07-17-02, 01:27 AM
  3. mov format
    By Mondiol in forum Software Forum
    Replies: 2
    Last Post: 05-20-02, 09:07 PM
  4. format help PLEASE
    By SVO-1 in forum Software Forum
    Replies: 2
    Last Post: 03-26-02, 08:40 PM
  5. format c/u/s
    By NuclearHeadache in forum Software Forum
    Replies: 7
    Last Post: 02-27-02, 09:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •