I have a code which does this,
Datetime dt = Datetime.NOW();
String starttime = dt.hour();
Now from the apex documentation, now() returns the current datetime based on GMT and hour() returns the hour component of the datetime in the local timezone of the context user.
Given this, I know that all the apex code always runs in the system context. SO I wanted to understand what is the context user here whose timezone will be considered to return the hour value. Also, does with sharing or without sharing have any effect on the hour() value ?
In my case this code is part of a web service code and is called in the context of an integration user. But I am not getting the expected values for hour() component.