|
So let's say you have a function that returns a date
Date myFunc(paramA, paramB){ //conditionally return a date?
}
So is it appropriate to return null from this function? This seems ugly because it forces clients to check for null.
The "null object" pattern...
Started by DanielHonig on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
If you return a "null" date, like 1970 they should check for....
Otherwise you end, which is an empty implementation of IProgressMonitor .
If it is possible a date won't be found then the null makes sense.
An exception instead.
|
|
I have a stored procedure which executes a select statement. I would like my results ordered by a date field and display all records with NULL dates first and then the most recent dates.
The statement looks like this:
SELECT a,b,c,[Submission Date] FROM...
Started by Eppz on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
ORDER BY (CASE WHEN [Submission Date] IS NULL THEN 1 ELSE 0 END) DESC, [Submission Date....
BY [Submission Date] IS NULL DESC, [Submission Date] ASC
try this
SELECT a,b,c,[Submission Date] FROM someView it.
|
|
How to set deafult null value in to a date field in the table,if the parameter containing the date value is null?
Started by Adarsh on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
TryDo you mean how do....
Null will be null and not change to a date.
Passed in is NULL?
Mark your date parameter like this:
@DOB DATETIME = '01/01/1900'
And the @DOB the 1900-01-01 00:00:00.000 value that you refer to.
|
Ask your Facebook Friends
|
Hi I am trying to return a collection which may potentially have null date values. However, if they are null - I want to keep them that way and not just use a arbitrary date instead.
If it was a string, I'd check for nulls like thus:
calEventDTO.occurrenceType...
Answer Snippets (Read the full thread at stackoverflow):
Try:
calEventDTO.recurrenceID = dr.IsDBNull(9) ? null : (DateTime?) dr.GetDateTime(9);
The ? operator requires both operands (null, and dr.GetDateTime(9) in this case) to be of the same type of the operands to DateTime?:
calEventDTO.recurrenceID....
|
|
Good Morning All. I've been struggling with this issue for a while now, and I can't seem to wrap my head around it.
So I have two tables in my Database
tblDateTrans CREATE TABLE [dbo].[tblDateTrans]( [Date] [smalldatetime] NOT NULL, )
This table is an...
Started by whobutsb on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
= 4)
to this:
AND (dbo.tblSurveySession.FK_StoreId = 4 OR dbo.tblSurveySession.FK_StoreId IS NULL, dbo.tblSurveySession.surveySessionID, dbo.tblSurveySession.FK_StoreId FROM OPENQUERY([APOLLO], 'select Date.
|
|
It's amzing when i send a null value in date() as a second parameter then it returns some time? how to remove this thing. i want that if a string is null or empty then doesn't do anything
$x=strtotime(); var_dump($x); var_dump($x==NULL); echo date('H:...
Started by I Like PHP on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
date() counts from 0, which to the date()....
NULL equals 0 in this case.
It makes perfect sense.
Why not check the value of $x ?
if($x != NULL) echo date('H:i',$x);
The second parameter that instead of date() .
|
|
I have the following in one of my result mappings.
<result property="updateDate" column="update_date" javaType="java.util.Date" jdbcType="DATE" nullValue="01/01/1900"/>
basically updateDate is a setter that accepts Date . However, sometimes updateDate...
Started by ratan on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
A null and set the "01/01/1900" Date in there?
This message can also occur when the setter doesn't? If you took that out, I assume the setter would be called by iBatis with 'null' and then you could.
|
|
I am having a very difficult time handling null returns in DB2. I've tried IFNULL AND COALESCE functions, but I still end up getting values in the return.
Here is the relevant segment of the query:
COALESCE ( DATE ( SUBSTR (DIGITS (PODATE),1,2) || char...
Started by David Hamilton on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Like:
select case when podate is null then date('12/31/99') else date (substr (podate,1,2) || char a simpler and faster:
select case when podate is null then date('12/31/99') else podate end
or, better if you're never....
|
|
I have a l ng SELECT ending with a ORDER BY that can include the following values :
checked (1 or 0) date (YYYY-MM-DD) time (HH:MM:SS) I'd like to order the result of the query the following way :
|__checked = 0 | |__ date ASC | |__ time ASC | |__ date...
Started by e-satis on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Null Dates Next, Null Times Next, Both Nulls Last , Checked , Date , Time
ORDER BY il.checked, CASE WHEN date IS NULL AND time IS NULL THEN 1 ELSE 0 END, date, time
an artificial order....
|
|
I'm currently converting my site from PHP to Django, but as I'm new to Python I'm struggling to get my head around a few thingss.
Sometimes I have incomplete dates in my database (ie I may not know the day or even the month), so currently have three integer...
Started by The Wilky Bar Kid on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Fuzzy....
You could store two datetimes as a range problem, but using PostgreSQL .
Also, Django converts dates into Python date or to store the date as text and process it yourself.
Is cross-database compatible it doesn't support this.
|