Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9016537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:01:10+00:00 2026-06-16T04:01:10+00:00

I am having query on the below sql. Please help me. select to_date(sysdate, ‘DD

  • 0

I am having query on the below sql.
Please help me.

 select to_date(sysdate, 'DD MONTH YYYY') , to_date(sysdate, 'yyyy/mm/dd hh24:mi:ss')
 from dual where 
 to_date(sysdate, 'DD MONTH YYYY') < to_date(sysdate, 'yyyy/mm/dd');

1) to_date(sysdate, ‘DD MONTH YYYY’) this will give Date object without time (may be time is 00:00).
Am i correct ? If not how will i get only Date object without Time in it?

2) From the above query It seems to_date(sysdate, ‘yyyy/mm/dd’) is greater than to_date(sysdate, ‘DD MONTH YYYY’). Why ??




Update


1) My aim in the above URL is to find out to_date function will only return date (or along with time) though format ‘DD MONTH YYYY’ is not mentioning the time chars(hh:mm..) in it.

2) From the response i got that to_date will return Date with time always though we didn’t mention the time chars.

3) Finally to get only DATE we should use trunc() / to_date(to_char(sysdate,’mm-dd-yyyy’),’mm-dd-yyyy’)

Check the below

select to_char(trunc(sysdate), 'yyyy/mm/dd hh24:mi:ss'), 
to_char(to_date(to_char(sysdate, 'yyyy-MM-dd'),'yyyy/mm/dd hh24:mi:ss'),'yyyy/mm/dd hh24:mi:ss') 
from dual;

–>hh24 :24 is important to get 00:00 format.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:01:11+00:00Added an answer on June 16, 2026 at 4:01 am

    you’ve just shot yourself in the foot. its called implicit datatype conversion.

    there is no TO_DATE(date) (which is what you’re asking for) , so oracle has converted your query to TO_DATE(TO_CHAR(sysdate), 'DD MONTH YYYY') where TO_CHAR(sysdate) will pick up the default NLS format mask. depending on your default mask (see NLS_SESSION_PARAMETERS), your 1st may have resolved to the year 0012 and the 2nd to the year 0018. so 0012 is less than 0018.

    if you want to truncate the sysdate, then just do trunc(sysdate)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some problems turning the SQL below into a Zend Db query.
I'm having this Mysql query, It works: SELECT nom ,prenom ,(SELECT GROUP_CONCAT(category_en) FROM (SELECT
I having trouble in my sql query .Please see my example As u see,
I am having this Linq To SQL query which is taking Customer Category from
I am having difficulty with writing an SQL query for my application. Below shows
I have a query like below select f.id, s.name, ss.name from first f left
I'm trying to convert the below SQL query to HQL and am having a
I'm currently making a cart and i'm having trouble with my SQL query below:
I have written an SQL script having the below query. The query works fine.
Having tried this query a million different ways, I can't seem to SELECT 'count_lonely_vehicles'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.