Click here to Skip to main content
15,898,776 members
Home / Discussions / C#
   

C#

 
Questionclosing and opening balance Pin
Er.Praveen Sharma6-May-13 21:38
Er.Praveen Sharma6-May-13 21:38 
AnswerRe: closing and opening balance Pin
Richard MacCutchan6-May-13 22:05
mveRichard MacCutchan6-May-13 22:05 
GeneralRe: closing and opening balance Pin
Er.Praveen Sharma6-May-13 23:48
Er.Praveen Sharma6-May-13 23:48 
AnswerRe: closing and opening balance Pin
Keith Barrow6-May-13 23:12
professionalKeith Barrow6-May-13 23:12 
GeneralRe: closing and opening balance Pin
Er.Praveen Sharma7-May-13 1:28
Er.Praveen Sharma7-May-13 1:28 
GeneralRe: closing and opening balance Pin
Keith Barrow7-May-13 1:49
professionalKeith Barrow7-May-13 1:49 
AnswerRe: closing and opening balance Pin
Simon_Whale6-May-13 23:52
Simon_Whale6-May-13 23:52 
GeneralRe: closing and opening balance Pin
Er.Praveen Sharma7-May-13 1:27
Er.Praveen Sharma7-May-13 1:27 
GeneralRe: closing and opening balance Pin
Simon_Whale7-May-13 3:08
Simon_Whale7-May-13 3:08 
QuestionWPF & MVVM Tutorials for Beginners Pin
Pradip P Patel6-May-13 20:52
Pradip P Patel6-May-13 20:52 
AnswerRe: WPF & MVVM Tutorials for Beginners Pin
Richard MacCutchan6-May-13 21:14
mveRichard MacCutchan6-May-13 21:14 
GeneralRe: WPF & MVVM Tutorials for Beginners Pin
Pradip P Patel6-May-13 23:52
Pradip P Patel6-May-13 23:52 
GeneralRe: WPF & MVVM Tutorials for Beginners Pin
Richard MacCutchan7-May-13 0:04
mveRichard MacCutchan7-May-13 0:04 
GeneralRe: WPF & MVVM Tutorials for Beginners Pin
Pradip P Patel7-May-13 1:40
Pradip P Patel7-May-13 1:40 
GeneralUnicode Characters A--Z Pin
N8tiv6-May-13 19:44
N8tiv6-May-13 19:44 
GeneralRe: Unicode Characters A--Z Pin
Richard MacCutchan6-May-13 20:51
mveRichard MacCutchan6-May-13 20:51 
GeneralRe: Unicode Characters A--Z Pin
N8tiv6-May-13 21:00
N8tiv6-May-13 21:00 
GeneralRe: Unicode Characters A--Z Pin
Richard MacCutchan6-May-13 21:26
mveRichard MacCutchan6-May-13 21:26 
GeneralRe: Unicode Characters A--Z Pin
N8tiv6-May-13 21:38
N8tiv6-May-13 21:38 
GeneralRe: Unicode Characters A--Z Pin
Richard MacCutchan6-May-13 22:04
mveRichard MacCutchan6-May-13 22:04 
GeneralRe: Unicode Characters A--Z Pin
N8tiv6-May-13 22:21
N8tiv6-May-13 22:21 
GeneralRe: Unicode Characters A--Z Pin
Richard MacCutchan6-May-13 22:28
mveRichard MacCutchan6-May-13 22:28 
QuestionHow to convert unix time to datetime (C#) ? Pin
Vijay Kanda6-May-13 19:35
Vijay Kanda6-May-13 19:35 
AnswerRe: How to convert unix time to datetime (C#) ? Pin
Richard MacCutchan6-May-13 20:42
mveRichard MacCutchan6-May-13 20:42 
AnswerRe: How to convert unix time to datetime (C#) ? Pin
Eric Lynch10-May-13 11:55
Eric Lynch10-May-13 11:55 
Not tested, but I believe the following should do the trick for you...

C#
/// <summary>
/// Calculate the starting time for Unix epoch (see http://en.wikipedia.org/wiki/Unix_time).
/// </summary>
public const long unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;

static DateTime toDateTimeUtc(
    long unixTime)
{
    return new DateTime(unixTime + unixEpoch, DateTimeKind.Utc);
}

static long toUnixTime(
    DateTime dateTime)
{
    return dateTime.ToUniversalTime().Ticks - unixEpoch;
}


-Eric.

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.