This is a migrated thread and some comments may be shown as answers.

Error in Date Format conversion

0 Answers 58 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ashwini
Top achievements
Rank 1
Ashwini asked on 08 Feb 2013, 04:16 AM
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.
Tags
Code Converter
Asked by
Ashwini
Top achievements
Rank 1
Share this question
or