Error in Date Format conversion

1 posts, 0 answers
  1. Ashwini
    Ashwini avatar
    1 posts
    Member since:
    Feb 2013

    Posted 07 Feb 2013 Link to this post

    I wanted to convert the below VB code to C# code.

    Dim dt As DateTime = DateTime.Now
    Dim sKey As String
    sKey=Format(dt,"yyyy/mm/dd hh:mm:ss")

    The Result I got from the online converter is as below:
    DateTime dt = DateTime.Now;
    string sKey = null;
    sKey = Strings.Format(dt, "yyyy/mm/dd hh:mm:ss");

    Firstly, there is no datatype called Strings in C#.
    Secondly, the String.Format function does not have any function that accepts the parameters in the above format.
Back to Top