[SOLVED] See Port #3.
Found a possible bug in NumberFormat.
Converting the ULong value 20250531 using NumberFormat(value, 0, 0) results in 20250532 instead 20250531?
So for this specific value 20250531 the result becomes off by 1 to 20250532.
Hardware: Arduino UNO, ESP32 Wrover-Kit. Software: B4R 4.00 (64-bit), Arduino-cli Version: 1.2.2
Test Code
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			Found a possible bug in NumberFormat.
Converting the ULong value 20250531 using NumberFormat(value, 0, 0) results in 20250532 instead 20250531?
So for this specific value 20250531 the result becomes off by 1 to 20250532.
Hardware: Arduino UNO, ESP32 Wrover-Kit. Software: B4R 4.00 (64-bit), Arduino-cli Version: 1.2.2
Test Code
			
				B4X:
			
		
		
		#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region
Sub Process_Globals
    Public Serial1 As Serial
End Sub
Private Sub AppStart
    Serial1.Initialize(115200)
  
    Dim datetimestamp As ULong = 20250530
    LogULong(datetimestamp)
'    >>>
'    1 datetimestamp=20250530             
'    2 datetimestamp NumberFormat=20250530    <-- OK
    datetimestamp = 20250531
    LogULong(datetimestamp)
'    >>>
'    1 datetimestamp=20250531
'    2 datetimestamp NumberFormat=20250532    <-- BUG? 20250531 converted to 20250532
  
    datetimestamp = 20250532
    LogULong(datetimestamp)
'    >>>
'    1 datetimestamp=20250532
'    2 datetimestamp NumberFormat=20250532    <-- OK
End Sub
Private Sub LogULong(value As ULong)
    Log(">>>")
    Log("1 datetimestamp=", value)
    Log("2 datetimestamp numberformat=", NumberFormat(value, 0, 0))
End Sub
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
	
								
							
							 
				 
 
		 
 
		 
						
					 
 
		