how to get current date from server in iOS?

guruprasad gudluri

I am sending today date to server but server shows yesterday date what's wrong with me? here i am using the code for getting date and sending date .

NSString *dateValue = borntext.text;
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"MM/dd/yyyy"];
NSDate *date = [formatter dateFromString:dateValue];
long dateInMillis = [date timeIntervalSince1970];



NSString *actDate = [NSString stringWithFormat:@"Date(%@)/",born];

        NSString *nDate = [[[[actDate componentsSeparatedByString:@"("] objectAtIndex:1] componentsSeparatedByString:@")"] objectAtIndex:0];

        NSDate *date = [NSDate dateWithTimeIntervalSince1970:([nDate doubleValue])];

        NSDateFormatter *dtfrm = [[NSDateFormatter alloc] init];

        [dtfrm setDateFormat:@"MM/dd/yyyy "];

        nDate = [dtfrm stringFromDate:date];

her i am converting milliseconds to date from server and sending date is convert to milli seconds.so please help me.thanks in advance

Droppy

You'll need to agree to use the same timezone, and GMT/UTC is generally accepted as the best common timezone.

Therefore set the NSDateFormatter timezone with:

formatter.timeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"];

The server "API" should document this; else I would raise it as a bug with the providers.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to get current date from server

From Dev

How to get start date of current year in iOS

From Dev

How to get the Current Year to Current date in sql server 2008

From Dev

How to get iOS date format of current date into an integer?

From Dev

How to get Current Quarter from Current Date using C#

From Dev

How to get last month previous date from current date in java

From Dev

How to convert date from server to NSString in ios

From Dev

how to get current/Todays date data in sql server

From Dev

How to get the date one month before from current date, when current date is January?

From Dev

How to subtract 30 days from the current date using SQL Server

From Dev

How get date and time from server?

From Dev

How to get current date from kendoDatePicker not in the 'change' handler

From Dev

How to get current Date from Internet via JavaScript

From Dev

How to get the value of current selected date from calendar eonasdan

From Dev

How to get current date and time from GPS unsegment time in python

From Dev

How to get leap seconds from gps epoch for current date in python

From Dev

How to get Current week from given array of objects date in javascript

From Dev

How to get the data from database on current date automatic

From Dev

How to get leap seconds from gps epoch for current date in python

From Dev

how to get current date/time in PHP from user

From Dev

How to get text and image from server in IOS

From Dev

How to get only current date?

From Dev

How to get Current Date time

From Dev

How to get the Current Date in ReactNative?

From Dev

How To Get Records From Date To Date SQL Server

From Dev

How to Get php code from other server and implement to current page

From Dev

iOS one month from current Date.

From Dev

iOS one month from current Date.

From Dev

Get Bookings from current date when using Date from - Date To

Related Related

  1. 1

    how to get current date from server

  2. 2

    How to get start date of current year in iOS

  3. 3

    How to get the Current Year to Current date in sql server 2008

  4. 4

    How to get iOS date format of current date into an integer?

  5. 5

    How to get Current Quarter from Current Date using C#

  6. 6

    How to get last month previous date from current date in java

  7. 7

    How to convert date from server to NSString in ios

  8. 8

    how to get current/Todays date data in sql server

  9. 9

    How to get the date one month before from current date, when current date is January?

  10. 10

    How to subtract 30 days from the current date using SQL Server

  11. 11

    How get date and time from server?

  12. 12

    How to get current date from kendoDatePicker not in the 'change' handler

  13. 13

    How to get current Date from Internet via JavaScript

  14. 14

    How to get the value of current selected date from calendar eonasdan

  15. 15

    How to get current date and time from GPS unsegment time in python

  16. 16

    How to get leap seconds from gps epoch for current date in python

  17. 17

    How to get Current week from given array of objects date in javascript

  18. 18

    How to get the data from database on current date automatic

  19. 19

    How to get leap seconds from gps epoch for current date in python

  20. 20

    how to get current date/time in PHP from user

  21. 21

    How to get text and image from server in IOS

  22. 22

    How to get only current date?

  23. 23

    How to get Current Date time

  24. 24

    How to get the Current Date in ReactNative?

  25. 25

    How To Get Records From Date To Date SQL Server

  26. 26

    How to Get php code from other server and implement to current page

  27. 27

    iOS one month from current Date.

  28. 28

    iOS one month from current Date.

  29. 29

    Get Bookings from current date when using Date from - Date To

HotTag

Archive