16

Is there any way to get rid of the time of day when using current_date or sysdate. I'm trying to only the store the date as YYYY-MM-DD , but current_date is giving me YYYY-MM-DD HH:MM:SS:MS

Or when comparing the dates, it only compares the date and not the time would be just as good. Any help would be awesome, thanks.

4

2 回答 2

40

Maybe you should try

trunc(sysdate)

function.

于 2013-03-30T19:55:46.793 回答
1

Rusty answered the part of your question regarding stripping the time portion. The part about incorporating the time when comparing dates is often done like this.

where YourDateField >= StartDate
and YourDateField < TheDayAfterEndDate

If you want to search on a specific date, StartDate and EndDate would be the same.

于 2013-03-30T20:04:13.707 回答