• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

How to set format to ToString("MM/dd/yyyy")?

I am trying to set format to a DATETIME var while passing it to a string.

I am getting the error: Error 4 Cannot implicitly convert type 'string' to 'System.DateTime?'
0
Rahn
Asked:
Rahn
  • 3
1 Solution
 
zadeveloperCommented:
use:



Convert.ToDateTime("1 Jan 200")

Open in new window

0
 
zadeveloperCommented:
2000 :)

Convert.ToDateTime("1 Jan 2000")

Open in new window

0
 
zadeveloperCommented:
Really sorry man

Convert.ToDateTime("1 Jan 2000").ToString("dd/MM/yyyy")

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now