sql - When and why does the TRUNC(DATE, [FORMAT]) used in the real world -


i getting oracle database. came across trunc(date, [fmt]) function. not clear on except seems return beginning value of sort?

can educate me on it? when or used @ work, or why might want use function?

another thing useful time component of current day. use expression time:

select sysdate - trunc(sysdate) todaystime dual 

because system date stored in decimal format (e.g. sysdate = 42651.2426897456) , integer value corresponds midnight, can use above statement decimal portion (e.g. todaystime = 0.2426897456, or before 6 am).

there may easier ways this, in applications has been easiest need work day's time component.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -