Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime conversion from json packet #10

Open
drewfus0 opened this issue Jan 20, 2016 · 1 comment
Open

DateTime conversion from json packet #10

drewfus0 opened this issue Jan 20, 2016 · 1 comment

Comments

@drewfus0
Copy link

Noticed that the date_entered and date_modified Failed to be converted to date correctly
Below is the json packet sent by the SugarCRM in response to a query.
the date modified is "2015-07-29T18:18:24+10:00"
so 29/07/2015 at 6:18pm in the time zone of (UTC+10:00).

but the accounts object shows as
29/07/2015 at 8:18 am.

{"next_offset":-1,"records":[{"my_favorite":false,"following":false,"id":"B66E222F70C9482481D8","name":"Lex \u0026 Josh Crosby","date_entered":"2015-07-20T15:38:00+10:00","date_modified":"2015-07-29T18:18:24+10:00","modified_user_id":"1","modified_by_name":"Chris Hall","created_by":"1","created_by_name":"Chris Hall","doc_owner":"","user_favorites":"","description":"","deleted":false,"assigned_user_id":"7f43b7e0-c80b-ae19-7bb4-55a78f82f7eb","assigned_user_name":"Nigel Semmens","team_count":"","team_name":[{"id":"6bb8acb7-4eb4-42ba-a66a-55ab40aa6d76","name":"NSW \u0026 QLD \u0026 NT","name_2":"","primary":false}],"email":[],"email1":"","email2":"","invalid_email":"","email_opt_out":"","email_addresses_non_primary":"","facebook":"","twitter":"","googleplus":"","account_type":["Farm"],"industry":"","annual_revenue":"","phone_fax":"02 6853 5100","billing_address_street":"Cherry Tree Hill","billing_address_street_2":"","billing_address_street_3":"","billing_address_street_4":"","billing_address_city":"FORBES","billing_address_state":"NSW","billing_address_postalcode":"2871","billing_address_country":"Australia","rating":"","phone_office":"02 6853 5136","phone_alternate":"","website":"","ownership":"","employees":"","ticker_symbol":"","shipping_address_street":"Cherry Tree Hill","shipping_address_street_2":"","shipping_address_street_3":"","shipping_address_street_4":"","shipping_address_city":"FORBES","shipping_address_state":"NSW","shipping_address_postalcode":"2871","shipping_address_country":"Australia","parent_id":"","sic_code":"","duns_num":"","parent_name":"","campaign_id":"","campaign_name":"","last_comment_c":"","followup_date_c":null,"last_contact_date_c":null,"calls_made_c":0,"meetings_held_c":0,"calls_month_c":0,"service_issues_c":0,"meetings_month_c":0,"service_month_c":0,"auto_followup_interval_c":"Prospect","primary_contact_c":"","prospect_number_c":"60247","beef_dairy_c":"Beef","status_c":"Client","bacp_rating_c":"B","membership_c":"NonMember","sub_region_c":"Central West","region_c":"New South Wales","prospect_id_jiwa_c":"B66E222F70C9482481D8","farm_type_c":"","herd_id_c":"","herd_size_c":null,"herd_test_c":"","shire_farm_id_c":"","breed_c":[],"breed_period_c":[],"contact_id_c":"","sla_calls_per_month_c":0,"sla_meetings_per_month_c":0,"sla_met_c":false,"sla_variance_c":0,"_acl":{"fields":{}},"_module":"Accounts"}]}

@voicenter
Copy link

i just change it to string and add this function to my class :
public string GetSugarDatetimeFormat(DateTime time )
{ DateTime dtTemp = System.DateTime.Now;
dtTemp = TimeZone.CurrentTimeZone.ToUniversalTime(dtTemp);
return String.Format("{0:yyyy-MM-dd HH:mm:ss}", dtTemp);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants