I have to populate the Current User Time-Zone DateTime in a DateTime field. I am trying this :
String str = datetime.now().format();
DateTime d = Datetime.valueOf(datetime.now().format());
DateTime dtm = (DateTime) DateTime.parse(str);
system.debug('datetime.now().format() = ' + str);
system.debug('Datetime.valueOf(datetime.now().format()) = ' + d);
system.debug('DateTime.parse(str) = ' + dtm);
But the problem is that after using format() it is giving the String format and converting it into DateTime using valueOf() & parse() giving the PST time which is the ORG Timezone, whereas I want the Current User time-zone DateTime. How can I get the CurrentUser Time-Zone DateTime in DateTime Data Type?