c# - Convert the date & time to GMT+10 date & time -


i want convert local time gmt+10 time. using asp.net , website hosted in azure. , in after date & time should set activitydate in below code.

timezoneinfo timezoneinfo; datetime datetime; timezoneinfo = timezoneinfo.findsystemtimezonebyid("e. australia standard time"); datetime = timezoneinfo.converttime(datetime.now, timezoneinfo); datetime ausdatetime= datetime.tostring("yyyy-mm-dd hh-mm-ss");   _activityservice.insertactivity(new activitydto { username = httpcontext.current.user.identity.name, activitytype = activityconstants.act_type_usr_mgt, activitydescription = activityconstants.usr_mgt_descr_forgot_pw, activitydate = datetime.now }); 

i found out answer question.

 var activitydate = timezoneinfo.converttimefromutc(datetime.now.touniversaltime(), timezoneinfo.findsystemtimezonebyid("e. australia standard time")) }); 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -