Click here to Skip to main content
15,918,889 members
Home / Discussions / C#
   

C#

 
Questiona question about displaying time ? help ... Pin
cmpeng3425-May-06 23:05
cmpeng3425-May-06 23:05 
AnswerRe: a question about displaying time ? help ... Pin
_AK_25-May-06 23:14
_AK_25-May-06 23:14 
AnswerRe: a question about displaying time ? help ... Pin
rah_sin25-May-06 23:21
professionalrah_sin25-May-06 23:21 
GeneralRe: a question about displaying time ? help ... [modified] Pin
albCode25-May-06 23:28
albCode25-May-06 23:28 
GeneralMessage Closed Pin
26-May-06 0:06
cmpeng3426-May-06 0:06 
GeneralRe: a question about displaying time ? help ... Pin
Stefan Troschuetz26-May-06 0:18
Stefan Troschuetz26-May-06 0:18 
GeneralRe: a question about displaying time ? help ... Pin
rah_sin26-May-06 0:23
professionalrah_sin26-May-06 0:23 
AnswerRe: a question about displaying time ? help ... Pin
J4amieC26-May-06 0:38
J4amieC26-May-06 0:38 
Just following your logic makes my brain ache!

DateTime.Now -> returns an instance of DateTime.
.Date -> gets JUSt the date part
.ToString() converts the DateTime instance to a string according to your PC settings

then:

Convert.ToDateTime(DateTime.Now.Date.ToString()) -->Confused | :confused: Convert a DateTime to a striing, then convert that string back to a dateTime..

and finally

ToString("MM/dd/yyyy hh:mm:ss") --> convert the whole lot back to a string.


How on earth did you come up with such a convoluted way of doing it? The reason you were getting just the date and 00:00:00 as the time is bacause thats exactly what you asked for by callin .Date on DateTime.Now

All you needed was:

DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")

and you would have got todays date and time in your required format.

Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour

QuestionSQL Netowrk Interfaces, error:26 - Error locating Server/Instance specified.) Pin
emran83425-May-06 22:43
emran83425-May-06 22:43 
AnswerRe: SQL Netowrk Interfaces, error:26 - Error locating Server/Instance specified.) Pin
Larantz26-May-06 0:29
Larantz26-May-06 0:29 
QuestionDepth first search Pin
shdelpiero25-May-06 22:26
shdelpiero25-May-06 22:26 
AnswerRe: Depth first search Pin
Larantz26-May-06 0:23
Larantz26-May-06 0:23 
GeneralRe: Depth first search Pin
_AK_26-May-06 0:26
_AK_26-May-06 0:26 
AnswerRe: Depth first search Pin
shdelpiero26-May-06 3:21
shdelpiero26-May-06 3:21 
QuestionActive Directory 2003 Pin
AnhTin25-May-06 21:41
AnhTin25-May-06 21:41 
QuestionData binding.. is it possible ? Pin
Imtiaz Murtaza25-May-06 20:25
Imtiaz Murtaza25-May-06 20:25 
Questionusing #define to define string constants [modified] Pin
abhijit pai25-May-06 20:20
abhijit pai25-May-06 20:20 
AnswerRe: using #define to define string constants [modified] Pin
Colin Angus Mackay25-May-06 23:13
Colin Angus Mackay25-May-06 23:13 
GeneralRe: using #define to define string constants [modified] Pin
abhijit pai25-May-06 23:33
abhijit pai25-May-06 23:33 
GeneralRe: using #define to define string constants [modified] Pin
Larantz26-May-06 0:24
Larantz26-May-06 0:24 
GeneralRe: using #define to define string constants [modified] Pin
Colin Angus Mackay26-May-06 11:15
Colin Angus Mackay26-May-06 11:15 
GeneralRe: using #define to define string constants [modified] Pin
abhijit pai29-May-06 3:36
abhijit pai29-May-06 3:36 
GeneralRe: using #define to define string constants [modified] Pin
Colin Angus Mackay29-May-06 4:49
Colin Angus Mackay29-May-06 4:49 
QuestionHow to monitor files created by perticular process in c# [modified] Pin
HirenSuchak25-May-06 19:50
HirenSuchak25-May-06 19:50 
QuestionGet the active sqlserver names Pin
Shiv525-May-06 19:16
Shiv525-May-06 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.