473,387 Members | 1,485 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,387 software developers and data experts.

i want to convert datetime into date only to get values from db

hi all i am newly graduate and started my first job.......i am geting problem to convert datetime into date only , i am trying to get values from sqlserver table with comparison of date. i am using c# what i am doing is:
switch (completed)
{
case 0 : if(date<DateTime.Today)
e.Cell.Text += "<tr><td style=\"font-size:8px;color:red;line-height:12px;vertical-align:center;\">";
e.Cell.Text += "<tr><td style=\"font-size:8px;color:blue;line-height:12px;vertical-align:center;\">";
break;
case 1 : e.Cell.Text += "<tr><td style=\"font-size:8px;color:green;line-height:10px;vertical-align:center;\">";
break;
}

in completed column either i have 0 or 1 . 0 i am using to get two values with comparison of date and 1 is showing true.

hopefully you will help me to solve this problem

waiting
Oct 1 '07 #1
1 2025
Plater
7,872 Expert 4TB
Well I made your code a little "neater" to have a better look at it.
What is you question exactly? I see that you are switching on a "completed" variable. if completed=0 then check to see if "date" was before today's date. if it is, you add some html data. Then, regardless of the outcome of that if statement, you add MORE html data (creating broken tags and incorrect html).
if completed==1 then you just add one set of html data.
Expand|Select|Wrap|Line Numbers
  1. switch (completed)
  2. {
  3.    case 0 : 
  4.       if(date<DateTime.Today)
  5.       {
  6.          e.Cell.Text += "<tr><td style=\"font-size:8px;color:red;line-height:12px;vertical-align:center;\">";
  7.       }
  8.       e.Cell.Text += "<tr><td style=\"font-size:8px;color:blue;line-height:12px;vertical-align:center;\">";
  9.       break;
  10.    case 1 : 
  11.       e.Cell.Text += "<tr><td style=\"font-size:8px;color:green;line-height:10px;vertical-align:center;\">";
  12.       break;
  13. }
  14.  
Oct 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Sorisio, Chris | last post by:
Ladies and gentlemen, I've imported some data from a MySQL database into a Python dictionary. I'm attempting to tidy up the date fields, but I'm receiving a 'mx.DateTime.Error: cannot convert...
19
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
5
by: goochey | last post by:
I'm trying to convert a Julian Date (Format "4365") into an actual calendar date in Visual Basic, can anyone help me out with this.
4
by: v0lcan0 | last post by:
I’m trying to cast and integer type to a varchar and then concatenate two varchar and ’01’ and convert it into datetime with the following code: CONVERT(datetime, { fn CONCAT({ fn...
6
by: Richard | last post by:
Hi all, Hope everybody is having an OK monday?!!? Quick question, I have a database in which the dates are stored as longs. I think the original program was VB and the dates were just cast...
15
by: JenHu | last post by:
Hi expert, I have a data field (birthdate) contains a datetime datatype (mm/dd/yyyy), how can I convert to mmdd?? say, the birthday is 8/1/1979 and convert to mmdd DOB =...
10
by: Philip Wagenaar | last post by:
I have some code to convert a date to the unixdatetime representation (number of seconds since 1970). Only problem is that it only counts from the whole day, it ignores the times part. So convert...
17
by: Terry Jolly | last post by:
New to C# ---- How do I convert a Date to int? In VB6: Dim lDate as long lDate = CLng(Date) In C#
0
by: feeblemind | last post by:
Hi everyone, I am having problem/troubles with creating an sql inline statement for our application. How do I create a statement/query that selects list of servers with defined date ranges, but...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
marktang
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,...
0
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...
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...

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.