2 questions...
The documentation shows a "property" call Now, which returns the current
date and time, but it is not valid for how I am using it.
If you declare a field as a DateTime, but never populate it, how can you
tell if it is null? 5 9753
Jim:
What do you need to do with it? For instance, DateTime.Now has a lot of
formatters and can do just most anything I've ever come across.
I don't have my IDE in front of me, but if you don't assign the object a
value, it should be null in C# or nothing in VB.NET. If may have some
other value, but I would think it'd be null. You can declare a DateTime in
the IDE and breakpoint before it. Step past it and see what it's value is.
You can check for whatever that is afterward.
HTH,
Bill
"Jim Heavey" <Ji*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.16... 2 questions...
The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it.
If you declare a field as a DateTime, but never populate it, how can you tell if it is null?
Jim:
I just remembered something...Dat eTime is a value type, nix that last
suggestion. Let me play with it for a second and I'll post back.
"Jim Heavey" <Ji*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.16... 2 questions...
The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it.
If you declare a field as a DateTime, but never populate it, how can you tell if it is null?
Hi,
DateTime DoStuff()
{
DateTime dateTime = DateTime.MinVal ue;
// Do other stuff.
return(dateTime );
}
void DoMoreStuff()
{
DateTime dateTime = DoStuff();
if(dateTime == DateTime.MinVal ue)
{
// invalid date.
}
}
John.
"Jim Heavey" <Ji*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.16... 2 questions...
The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it.
If you declare a field as a DateTime, but never populate it, how can you tell if it is null?
On 2004-01-03, Jim Heavey <Ji*******@nosp am.com> wrote: 2 questions...
The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it.
If you declare a field as a DateTime, but never populate it, how can you tell if it is null?
DateTime object are value types, they are never null, in the same way
that ints and longs can never be null.
If you declare a local variable as DateTime, the compiler won't let you
use it until you populate it. If you declare a member variable as a
DateTime, it will be equal to DateTime.MinVal ue.
And I'm not really sure what your first question refers to. How do you
want to use it?
--
David
dfoster at
hotpop dot com
Jim,
In addition to the others comments about using DateTime.MinVal ue.
You might consider using System.Data.Sql Types.SqlDateTi me, as it is a value
type that has the concept of being "Nullable".
Hope this helps
Jay
"Jim Heavey" <Ji*******@nosp am.com> wrote in message
news:Xn******** *************** **********@207. 46.248.16... 2 questions...
The documentation shows a "property" call Now, which returns the current date and time, but it is not valid for how I am using it.
If you declare a field as a DateTime, but never populate it, how can you tell if it is null? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ken Varn |
last post by:
I want to be able to determine my current line, file, and function in my C#
application. I know that C++ has the __LINE__, __FUNCTION__, and __FILE___
macros for getting this, but I cannot find a C# equivalent. Any ideas?
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
varnk@diebold.com
|
by: James P. |
last post by:
Hello there,
In my asp.net page using VB, I have a date text field in mm/dd/yyyy
format. When a date is entered, I'd like to validate it to make sure
the date is greater than or equal to the current date. If not, I'd
like to display the error message to ValidationSummary.
It seems to make sense to me to use CompareValidator but the problem
is put the current date into CompareValidator. So, I created a hidden
text field in my aspx. ...
|
by: Scott |
last post by:
I have a start date and an end date in my project that is defaulted to the current date at run-time using the following code...
Date1.Value = Now()
Date2.Value = Now()
I then have some code that works out the number of days between the 2 dates as follows...
Dim d1, d2 As Date
|
by: Mark Ingram |
last post by:
Hi, I'd like to know the best way of checking the current time during a
demonstration product. At the minute i store the first run date, then
compare that to the system time, but obviously a user can just change
their clock back a month and continue using the product.
I heard it is best to check the access time on a system dll? I had a
quick look at the user32.dll file and realised the access time was the
time my machine booted up, but...
|
by: simbarashe |
last post by:
Hie
could someone please help me with getting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as follows:
The code below is for the first page:session_start is in line 3
<link href="css/jobSheet.css" rel="stylesheet" type="text/css" />
session_start();
| |
by: nano |
last post by:
Using python 2.2 what is the simplest way to get the current date value?
I have looked in so many places. The question is often asked and the
usual response indicates how to get the current date and time like
now = time.localtime()
I want just the date, like 2007-06-15. The value will go into a
postgresql Date type column.
Also, if postgres field of this type is set to time.localtime(), is the
|
by: Steve Rainbird |
last post by:
Is there a way in DB2 I can get the current date and time formatted.
In Oracle I could do the following
select to_char(sysdate,'yyyymmdd') from dual
returns
20070718
|
by: Gilberto |
last post by:
Hello
I have a form where the user enters some pricing information. I need to store in the pricing table (fields time and date) the time and date WHEN the information was entered, so that later the user can print a report with these forms and can see EACH form at what time and date it was ORIGINALLY created/modified.
So far i added two textbox to the form with time and date that show the CURRENT time and date, but when i try to print the...
|
by: trytobreak |
last post by:
Hi All,
I am a network administrator in a fairly large software company and I
would like to write myself a small utility, which would connect (one
by one) to all machines on the network and get their current date and
time stamps.
This is mostly because of coming DST changes and having hundreds of
machines on the network, I don't want to connect remotely to every and
each server to see if the time is correct.
|
by: WannabePrgmr |
last post by:
I am trying to display total numbers of data in a textbox, "Textbox200" on a form "Master", but I only want to display current daily data.
I currently get the data from:
Me.Text200 = DCount("", "")
which gets the total "Live" data from the "LIVEquery", which is updated in the Form_Current.
I would like to change this to look at the current date and only query for data entered during that date.
I have a textboxx with the following in...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |