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

  • Home
  • SEARCH
  • 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 8818973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:14:17+00:00 2026-06-14T05:14:17+00:00

I’m an objective-c beginner and I was assigned to create an iPhone app for

  • 0

I’m an objective-c beginner and I was assigned to create an iPhone app for our client. I have some background with Java but almost no experience in this objective-c and this is my first time to developping a complete application…

Anyway, I’m currently stack at several problems. One of those problem is that I need to send an integer value for PHP’s date function from my iOS app. I’ve been searching around for the solution, but all of them are dealing with opposite ways (int to NSDate), not NSDate to integer value.

I tried solutions like answered here
but it’s obvious it returns double, not an integer…
Or this
but this couldn’t get the System time.

I know I could get current system’s NSDate with:

NSDate *theDay = [NSDate dateWithTimeIntervalSinceNow:[[NSTimeZone systemTimeZone] secondsFromGMT]];  

But I could not figure out how to convert this to an integer (or long) value.

I just need to get the same value as we can get in Java with System.currentTimeMillis().

Also, this is my first time to ask questions here in stackoverflow. So please let me know if there’s anything I should do/not to do when posting questions here, etc.

Thank you.

  • 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-14T05:14:18+00:00Added an answer on June 14, 2026 at 5:14 am

    To get the current date, you should use this:

    NSDate *theDate = [NSDate date];
    

    To get it in seconds since January 1st, 1970, as a double, you would use:

    NSTimeInterval seconds = [[NSDate date] timeIntervalSince1970];
    

    To get it in ms, simply multiply the previous value by 1000 and let the compiler cast it into an integer without needing any additional code:

    long long milliseconds = [[NSDate date] timeIntervalSince1970] * 1000;
    

    And as @HotLicks points out, while System.currentTimeMillis() is in GMT, if you need the local time, you could use:

    long long milliseconds = ([[NSDate date] timeIntervalSince1970] 
                            + [[NSTimeZone defaultTimeZone] secondsFromGMT]) * 1000; 
    

    (I think that most web services will want GMT though.)

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
This could be a duplicate question, but I have no idea what search terms
I have thousands of HTML files to process using Groovy/Java and I need to
Let's say I'm outputting a post title and in our database, it's Hello Y’all
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but

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.