Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 291
  • Last Modified:

equiv of vb's #1/1/2001#

hi all,

just a simple one - how does one write date literals in c#? (can we?)

trying to turn a vb code snippet:

Calendar1.SelectedDate = #12:00:00 AM#

into c#

TIA

0
krash0r
Asked:
krash0r
1 Solution
 
tpattenCommented:
There is no "Date Literal" in C#, or .NET for that matter. You need to use the DateTime object.

You can do Calendar1.SelectedDate = DateTime.Today()

What date are you trying to set?
0
 
Nebulus_Commented:
Calendar1.SelectedDate = DateTime.Parse("8:30:40 PM");
0
 
krash0rAuthor Commented:
ah that's ok then. yea I'll just have to resort to DateTime.Parse! cheers
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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