G Guest Feb 9, 2005 #1 I'm getting my data from my database in seconds, 3600, how can i convert that to time such as 1:00 pm?
I'm getting my data from my database in seconds, 3600, how can i convert that to time such as 1:00 pm?
C Cor Ligthert Feb 9, 2005 #2 Mike, The one which a regular from this newsgroup consequently forget. http://msdn.microsoft.com/library/d.../frlrfsystemtimespanclassfromsecondstopic.asp I hope this helps? Cor
Mike, The one which a regular from this newsgroup consequently forget. http://msdn.microsoft.com/library/d.../frlrfsystemtimespanclassfromsecondstopic.asp I hope this helps? Cor
G Guest Feb 9, 2005 #3 I'll check that out, but i've seen it done in 2 lines of code as well and now i can't find that snippet again. thx
I'll check that out, but i've seen it done in 2 lines of code as well and now i can't find that snippet again. thx
C Cor Ligthert Feb 9, 2005 #4 Mike, I'll check that out, but i've seen it done in 2 lines of code as well and now i can't find that snippet again. Click to expand... In the sample in the link it is one line of code, however maybe can you as in that break it up in two than it looks like two. MessageBox.Show(TimeSpan.FromSeconds(3600).ToString) Cor
Mike, I'll check that out, but i've seen it done in 2 lines of code as well and now i can't find that snippet again. Click to expand... In the sample in the link it is one line of code, however maybe can you as in that break it up in two than it looks like two. MessageBox.Show(TimeSpan.FromSeconds(3600).ToString) Cor
J Jay B. Harlow [MVP - Outlook] Feb 9, 2005 #5 Mike, I normally use TimeSpan.FromSeconds (as Cor suggested): Dim ts As TimeSpan = TimeSpan.FromSeconds(3600) If you want it as a "Date" I normally add the TimeSpan to a "known" DateTime. Dim dt As DateTime = DateTime.MinValue.Add(ts) Alternatively you can add the seconds to a "known" DateTime. Dim ts As DateTime = DateTime.MinValue.AddSeconds(3600) Hope this helps Jay
Mike, I normally use TimeSpan.FromSeconds (as Cor suggested): Dim ts As TimeSpan = TimeSpan.FromSeconds(3600) If you want it as a "Date" I normally add the TimeSpan to a "known" DateTime. Dim dt As DateTime = DateTime.MinValue.Add(ts) Alternatively you can add the seconds to a "known" DateTime. Dim ts As DateTime = DateTime.MinValue.AddSeconds(3600) Hope this helps Jay
G Guest Feb 9, 2005 #6 will these work with a dataitem from a dataset? Jay B. Harlow said: Mike, I normally use TimeSpan.FromSeconds (as Cor suggested): Dim ts As TimeSpan = TimeSpan.FromSeconds(3600) If you want it as a "Date" I normally add the TimeSpan to a "known" DateTime. Dim dt As DateTime = DateTime.MinValue.Add(ts) Alternatively you can add the seconds to a "known" DateTime. Dim ts As DateTime = DateTime.MinValue.AddSeconds(3600) Hope this helps Jay Click to expand...
will these work with a dataitem from a dataset? Jay B. Harlow said: Mike, I normally use TimeSpan.FromSeconds (as Cor suggested): Dim ts As TimeSpan = TimeSpan.FromSeconds(3600) If you want it as a "Date" I normally add the TimeSpan to a "known" DateTime. Dim dt As DateTime = DateTime.MinValue.Add(ts) Alternatively you can add the seconds to a "known" DateTime. Dim ts As DateTime = DateTime.MinValue.AddSeconds(3600) Hope this helps Jay Click to expand...
J Jay B. Harlow [MVP - Outlook] Feb 9, 2005 #7 Mike, Yes of course they do. Obviously you may need to convert types to/from the parameters expected & returned. The DataSet supports TimeSpans, however I have not tried getting them into & out of a database... Hope this helps Jay
Mike, Yes of course they do. Obviously you may need to convert types to/from the parameters expected & returned. The DataSet supports TimeSpans, however I have not tried getting them into & out of a database... Hope this helps Jay