1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to format date in Hibernate HQL?

Discussion in 'Programming' started by inegoita, Nov 5, 2019.

  1. #1

    I am using Hibernate in my Spring Java app and I have an object Event with a field eventDate of type Date.

    What are my options for formatting a date to a string using the YYYY-MM-DD format? I guess I could retrieve the field as a date, and then format the date in Java, but that's probably not too efficient.

    My app is currently setup to work with a MySQL database, but I would also like it to work on Postgresql.

    thanks in advance!
    inegoita, Nov 5, 2019 IP
  2. LewisH95

    LewisH95 Greenhorn

    Likes Received:
    Best Answers:
    Trophy Points:
    You can use the following that converts a date to a string with the specified format:

    LewisH95, May 7, 2020 IP