I have one custom DateTime field named "Transaction Date". While inserting the records I am assigning today's date to Transaction Date.But when I see the record, Transaction Date value is a day lesser. Please help..
It's because Salesforce stores data in GMT, and you'll need to compensate for it by adding or subtracting however many hours you are from GMT. For example, in California, I have to subtract 8 or 7 depending on DST. See this article: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_timezone.htm
The reason for this is all Date/Time fields are stored in the API as GMT time for data integrity purposes.
What happens when the data is imported in is it converts to the Time Zone and Locale settings of the User that is viewing the Date/Time field in a particular record each time.
The value in salesforce is stored in GMT but while viewing on the UI it adjusts the value to users time zone. Since users time zone is (GMT-04:00) Eastern Daylight Time (America/New_York), it is showing a day lesser. However in the database the value is populated correctly.