Solved

I can't seem to find the DateTime data type??

Posted on 2008-10-04
6
218 Views
Last Modified: 2013-11-26
Greetings Experts!
I am using Microsoft Visual Studio 2005 and I have VS Sp1 installed too, the problem I am facing is that in the code behind page I am trying to create variables of the type DateTime, but the DateTime type doesn't get listed on the data types list that pops up, so I am wondering is there a namespace that I need to import for me to use the DateTime data types.??

thanks in advance.

~salman~
0
Comment
Question by:salman_sulaiman_2008
6 Comments
 
LVL 4

Accepted Solution

by:
petr_hlucin earned 100 total points
ID: 22640326
DateTime is located in System namespace. If you still don't see it in IntelliSense try simply typing it there manually and compiling.
0
 
LVL 6

Assisted Solution

by:DocCan11
DocCan11 earned 200 total points
ID: 22640332
It is found in the system namespace..

vb - dim x as system.datetime
c#  System.DateTime x;
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 100 total points
ID: 22640376
woulde be better if you write at the beginning of each source file:

Imports System

So you don't have to type System.... every time you need a date time or other fundamental class
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Assisted Solution

by:DocCan11
DocCan11 earned 200 total points
ID: 22640455
The system namespace is normally either imports (vb) or using (c#) at the start of any file codefile unless it was accidently deleted... That does not mean though that intellisence always picks up things.. so sometimes you still have to put the full name of the class in including the namespace
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 22641019
That drives me nuts too...I have to constantly hit the escape key so I can actually code a DateTime.

Intellisense defaults to the newer DateTimeOffset:
http://msdn.microsoft.com/en-us/library/bb384267.aspx

DateTime: http://msdn.microsoft.com/en-us/library/system.datetime(VS.80).aspx
DateTimeOffset: http://msdn.microsoft.com/en-us/library/system.datetimeoffset.aspx

0
 

Author Comment

by:salman_sulaiman_2008
ID: 22643500
Greetings everyone!
thanks for the replies! I really appreciate it!
I actually realised that the DateTime type was already on the list, I just had to click on the "ALL" instead of "Common", it seems that the popup list shows the common data types and not all of them, so when I clicked on view ALL then I found the DateTime type.

Best Wishes,

~Salman~
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now