Skip to main content
Solved

Generic Inquiry =day() function not working as expected

  • February 13, 2025
  • 4 replies
  • 65 views

We were trying to do calculations on orders created each day but the date/time field constrains us.  Parsing out the month/day/year into a new field should have worked, however we are noticing some unusual discrepancies.  It appears anything after 7pm EST is rolling to the next day unprompted.

 

SOOrder.CreateDateTime = 2/12/2025 7:32 PM

=cdate(Concat(CStr(Month([SOOrder.CreatedDateTime])),'/',CStr(Day([SOOrder.CreatedDateTime])),'/',CStr(Year([SOOrder.CreatedDateTime])))) = 2/13/2025

=Day([SOOrder.CreatedDateTime]) = 13

 

SOOrder.CreateDate = 2/12/2025 5:32 PM

=cdate(Concat(CStr(Month([SOOrder.CreatedDateTime])),'/',CStr(Day([SOOrder.CreatedDateTime])),'/',CStr(Year([SOOrder.CreatedDateTime])))) = 2/12/2025

=Day([SOOrder.CreatedDateTime]) = 12

 

 

Best answer by adaughenbaugh95

BenjaminCrisman wrote:

@adaughenbaugh95 What you’re seeing is that all dates are actually stored in the database in UTC time, when calling a field into a GI it will adjust for user time zone.

Exceptions are when the field is used in an expression it will force the UTC value.

Users are getting an error trying to filter on the field.

Filter on columfield = @Today (today) or @Today - 1 (yesterday)

The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.


I had to reformat my field further.  
=cdate(Concat(CStr(Month(dateadd([SOOrder.CreatedDateTime],'h',-5))),'/',CStr(Day(dateadd([SOOrder.CreatedDateTime],'h',-5))),'/',CStr(Year(dateadd([SOOrder.CreatedDateTime],'h',-5)))))

View original
Did this topic help you find an answer to your question?

4 replies

BenjaminCrisman
Acumatica Employee
Forum|alt.badge.img+4
  • Acumatica Support Team
  • 701 replies
  • February 13, 2025

@adaughenbaugh95 What you’re seeing is that all dates are actually stored in the database in UTC time, when calling a field into a GI it will adjust for user time zone.

Exceptions are when the field is used in an expression it will force the UTC value.


BenjaminCrisman wrote:

@adaughenbaugh95 What you’re seeing is that all dates are actually stored in the database in UTC time, when calling a field into a GI it will adjust for user time zone.

Exceptions are when the field is used in an expression it will force the UTC value.

Thank you for the confirmation.

I have updated my formula to adjust.

=cdate(Concat(CStr(Month([SOOrder.CreatedDateTime])),'/',
CStr(Day(dateadd([SOOrder.CreatedDateTime],'h',-5))),
'/',CStr(Year([SOOrder.CreatedDateTime]))))


Forum|alt.badge.img
  • Jr Varsity I
  • 57 replies
  • February 13, 2025

Hi @adaughenbaugh95

In addition to ​@BenjaminCrisman comment, all dates are actually stored in the database in UTC time.

Modify your expression to adjust for EST time zone shift.

=CDate(DateAdd("h", -5, [SOOrder.CreatedDateTime]))

I hope, it helps!


  • Author
  • Freshman II
  • 6 replies
  • Answer
  • February 13, 2025
BenjaminCrisman wrote:

@adaughenbaugh95 What you’re seeing is that all dates are actually stored in the database in UTC time, when calling a field into a GI it will adjust for user time zone.

Exceptions are when the field is used in an expression it will force the UTC value.

Users are getting an error trying to filter on the field.

Filter on columfield = @Today (today) or @Today - 1 (yesterday)

The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.


I had to reformat my field further.  
=cdate(Concat(CStr(Month(dateadd([SOOrder.CreatedDateTime],'h',-5))),'/',CStr(Day(dateadd([SOOrder.CreatedDateTime],'h',-5))),'/',CStr(Year(dateadd([SOOrder.CreatedDateTime],'h',-5)))))


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings