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

Posted on 2003-03-03
Medium Priority
Last Modified: 2010-04-15
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#


Question by:krash0r
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

tpatten earned 150 total points
ID: 8062025
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?

Expert Comment

ID: 8063043
Calendar1.SelectedDate = DateTime.Parse("8:30:40 PM");

Author Comment

ID: 8063693
ah that's ok then. yea I'll just have to resort to DateTime.Parse! cheers

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question