473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Application value null

Hi experts!
If system time 12:00 am my application variable value will be
null.. I am trying to get null value of application but that time i'll
make some actions to that page.. So pls tell me how i'll make null

Nov 25 '06 #1
7 1668
I'd like to help, but I'm having difficulty understanding what you are
trying to say. Can you post a snippet of your code that shows the problem
you are having?

Thanks,
-Chris

"Sala" <sa**********@gmail.comwrote in message
news:11**********************@45g2000cws.googlegro ups.com...
Hi experts!
If system time 12:00 am my application variable value will be
null.. I am trying to get null value of application but that time i'll
make some actions to that page.. So pls tell me how i'll make null
Nov 25 '06 #2
If system time 12:00 am my application variable value will be
null.. I am trying to get null value of application but that time i'll
make some actions to that page.. So pls tell me how i'll make null
I'm not sure I understand your question, but if you're asking how to set
a DateTime to null, the answer is, you can't, it's a value type.

However, you can use a nullable version of DateTime (if you are using
the latest C# version).

Something like this:

//-----------------------------------------
private DateTime? MyTime()
{
DateTime? now = DateTime.Now;
if ( now.Value.TimeOfDay == new TimeSpan( 0, 0, 0 ) )
now = null;
return now;
}
//-----------------------------------------

By the way, DateTime? is just a syntactic shortcut for:
Nullable<DateTime>

I hope I answered the right question. :)

David

Nov 25 '06 #3
Another possibility is to use DateTime.MaxValue or DateTime.MinValue.
These are guaranteed to be greather than, or less than, respectively
than any actual datetime value. You could use these as a kind of pseudo
null value. AND it's of type DateTime, of course.
On 2006-11-25 05:50:29 -0600, David Boucherie & Co
<da*************@telenet.besaid:
> If system time 12:00 am my application variable value will be
null.. I am trying to get null value of application but that time i'll
make some actions to that page.. So pls tell me how i'll make null

I'm not sure I understand your question, but if you're asking how to
set a DateTime to null, the answer is, you can't, it's a value type.

However, you can use a nullable version of DateTime (if you are using
the latest C# version).

Something like this:

//-----------------------------------------
private DateTime? MyTime()
{
DateTime? now = DateTime.Now;
if ( now.Value.TimeOfDay == new TimeSpan( 0, 0, 0 ) )
now = null;
return now;
}
//-----------------------------------------

By the way, DateTime? is just a syntactic shortcut for:
Nullable<DateTime>

I hope I answered the right question. :)

David

Nov 25 '06 #4
Bob Jones <ro****@joneshouse.comwrote:
Another possibility is to use DateTime.MaxValue or DateTime.MinValue.
These are guaranteed to be greather than, or less than, respectively
than any actual datetime value. You could use these as a kind of pseudo
null value. AND it's of type DateTime, of course.
Well, they're guaranteed to be greater than or less than any *other*
actual DateTime value - but they're valid DateTime values in
themselves.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 25 '06 #5
Quit picking nits. You know what I mean. Show me "MinValue" on a clock.

On 2006-11-25 12:33:10 -0600, Jon Skeet [C# MVP] <sk***@pobox.comsaid:
Bob Jones <ro****@joneshouse.comwrote:
>Another possibility is to use DateTime.MaxValue or DateTime.MinValue.
These are guaranteed to be greather than, or less than, respectively
than any actual datetime value. You could use these as a kind of pseudo
null value. AND it's of type DateTime, of course.

Well, they're guaranteed to be greater than or less than any *other*
actual DateTime value - but they're valid DateTime values in themselves.

Nov 26 '06 #6
Bob Jones <ro****@joneshouse.comwrote:
Quit picking nits. You know what I mean. Show me "MinValue" on a clock.
I could show you January 1st 1AD on a calendar just as easily as I
could show you January 2nd 1AD.

Just beceause you won't see it called MinValue doesn't mean that
they're not "actual" DateTime values.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 26 '06 #7
On 2006-11-26 01:59:16 -0600, Jon Skeet [C# MVP] <sk***@pobox.comsaid:
Bob Jones <ro****@joneshouse.comwrote:
>Quit picking nits. You know what I mean. Show me "MinValue" on a clock.

I could show you January 1st 1AD on a calendar just as easily as I
could show you January 2nd 1AD.

Just beceause you won't see it called MinValue doesn't mean that
they're not "actual" DateTime values.
Ok, ok. We're violently agreeing here. I quote my previous post:
" AND it's of type DateTime, of course."

Nov 26 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
4
by: Chris Newby | last post by:
My project currently requires that I integrate an ASP.NET application with an ASP application. One of the issues I'm having is that I have some very long strings being created in an ASP.NET...
5
by: newjazzharmony | last post by:
I want to share one instance of an object across an ASP dot net application, and I'm trying to weigh the pros and cons of the following two approaches: a) Storing the object in ApplicationState...
4
by: Fred Nelson | last post by:
Hi: This is probably a newby question however I can't figure it out! I'm trying to use application data caching in a web application. I have read an article on 4 guys from rolla that shows...
5
by: james.jdunne | last post by:
System.ArgumentException: Item has already been added. Key in dictionary: "-1" Key being added: "-1" at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at...
3
by: Firecore | last post by:
Does anyone know how to use this? I was browsing a few tutorials on the net, and I saw one that shows how to display stuff on the screen. I added a few events. This is my code: #include...
1
by: CodeSeeker | last post by:
I have an application, which uses pop3 to read the messages from the mailbox, and it has been working fine for so many year. We recently have started changing this application to use java mail IMAP 4...
1
by: raul15791 | last post by:
Hi, I'm new to C#. I'm writing a program that open a new excel file, write into it and lastly close the file. But the program is that there will be a orphaned process named EXCEL.EXE left on the...
1
by: aboalnodom | last post by:
hello guys, i hope any one will help in this i am designing a web application, the page i am workin on its the default.aspx it contains dropdownboxes the first 4 to choose the type and the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
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,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.