Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:04:09+00:00 2026-06-01T03:04:09+00:00

The following code crashes and burns and I don’t understand why: DateTime dt =

  • 0

The following code crashes and burns and I don’t understand why:

DateTime dt = new DateTime(1970,1,1,0,0,0,0, DateTimeKind.Utc);
double d = double.Parse("1332958778172");

Console.Write(dt.AddSeconds(d));

Can someone tell me what’s going on? I just can’t seem to be able to figure out why…

EDIT

This value comes back from the Salesforce REST API and from what I understand it’s a Unix epoch time stamp. “The time of token issue, represented as the number of seconds since the Unix epoch (00:00:00 UTC on 1 January 1970).”

SOLUTION

Salesforce REST API is in fact sending milliseconds back for the issued_at field when performing the OAuth request when they say they’re sending seconds…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:04:11+00:00Added an answer on June 1, 2026 at 3:04 am

    As others have said, the problem is that the value is too large.

    Having looked over it, I believe it represents milliseconds since the Unix epoch, not seconds so you want:

    DateTime dt = new DateTime(1970,1,1,0,0,0,0, DateTimeKind.Utc);
    double d = double.Parse("1332958778172");  // Or avoid parsing if possible :)
    Console.Write(dt.AddMilliseconds(d));
    

    Either that, or divide by 1000 before calling AddSeconds – but obviously that will lose data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code crashes with an exception : MyWindow wnd = new MyWindow(); wnd.Show();
I wanted to know why the following code crashes. int main( ) { int
I have discovered that the following PHP code crashes when it runs on a
Take the following code: ImageView imageView = new ImageView(activity); imageView.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); Running this
The following code crashes on the second Pop() call. I'm a novice with C
I am using following code. When the query crashes, it is not displaying the
Assume the following code: using (SqlConnection conn = new SqlConnection(connectionString)) { ... using (SqlCommand
I use the following code to insert new lines efficiently in a DB :
I have the following code: var psi = new ProcessStartInfo(); psi.FileName = @C:\gw\gw.exe; psi.WorkingDirectory=@C:\gw;
I have the following code that crashes at the line where I am initializing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.