@RKarunarathne51
Just a clarifying question.
When you say “System Time”, are you referring to “Acumatica System” time, commonly referred to as “Business Date”, or are you wanting to retrieve the current UTC (Computer) time?
Acumatica already stores the time when a record is created for most records. It’s called CreatedDateTime.
I’ve seen a couple of your recent questions and they are very general. If you want specific and applicable suggestions, we need some details about what you’re trying to accomplish. There is not a one-size fits all in Acumatica. The basic mechanisms of the platform are somewhat universal, but each screen is unique in how those mechanisms have been combined.
@MichaelShirk ,
I want to retrieve the current UTC (Computer) time. Thank you
Hi @RKarunarathne51
var machineTime = DateTime.Now;
var machineTimeUtc = DateTime.UtcNow;
var instanceTime = PXTimeZoneInfo.Now;
var instanceTimeUtc = PXTimeZoneInfo.UtcNow;
Here are multiple options you can use to get the time depending on your use case.
Make sure you understand the difference between server (machine) time and instance (Acumatica) time. It isn’t exactly the same thing (for me they are different most of the time).
I’d also want to stress again what Daryl said before - we are creating Audit fields for that reason in DACs. If you are using your custom DAC, take a look at a standard one (most of Acumatica’s DACs have these audit fields). What you ask sounds exactly like CreatedDateTime.
If you use your custom DAC, I’d urge you to add the full set of audit fields, to avoid stumbling upon issues each time they are required, but not added.