Skip to main content
Solved

Date & Time Split Error

  • March 16, 2023
  • 1 reply
  • 115 views

tahirsiddiqui190
Freshman I
Forum|alt.badge.img

i Split Date and time 

but its shows wrong time 

=Right('0'+CStr(Hour([AMClockTran.StartTime])),2)+':'+Right('0'+CStr(Minute([AMClockTran.StartTime])),2)

Best answer by sweta68

 Hi @tahirsiddiqui190 ,

I have used same formula in GI and It shows time in 24 hours format, If you want to display it in 12 Hours format, You can use below formula.

=IIF(HOUR([AMBomItem.CreatedDateTime])<=12,PADLEFT(CSTR(HOUR([AMBomItem.CreatedDateTime])),2,'0')+':'+PADLEFT(CSTR(MINUTE([AMBomItem.CreatedDateTime])),2,'0')+ ' AM',PADLEFT(CSTR(HOUR([AMBomItem.CreatedDateTime])-12),2,'0')+':'+PADLEFT(CSTR(MINUTE([AMBomItem.CreatedDateTime])),2,'0')+ ' PM')

Below is our result using the above formula. 

Note: Just use required field instead of AMBomItem.CreatedDateTime.

Hope, This helps!

Regards

Sweta

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

1 reply

Forum|alt.badge.img+9
  • Semi-Pro III
  • 229 replies
  • Answer
  • March 16, 2023

 Hi @tahirsiddiqui190 ,

I have used same formula in GI and It shows time in 24 hours format, If you want to display it in 12 Hours format, You can use below formula.

=IIF(HOUR([AMBomItem.CreatedDateTime])<=12,PADLEFT(CSTR(HOUR([AMBomItem.CreatedDateTime])),2,'0')+':'+PADLEFT(CSTR(MINUTE([AMBomItem.CreatedDateTime])),2,'0')+ ' AM',PADLEFT(CSTR(HOUR([AMBomItem.CreatedDateTime])-12),2,'0')+':'+PADLEFT(CSTR(MINUTE([AMBomItem.CreatedDateTime])),2,'0')+ ' PM')

Below is our result using the above formula. 

Note: Just use required field instead of AMBomItem.CreatedDateTime.

Hope, This helps!

Regards

Sweta


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