What is a Hive Date Function?PlatformThe Databricks Lakehouse PlatformDelta LakeData GovernanceData EngineeringData StreamingData WarehousingData SharingMachine LearningData SciencePricingMarketplaceOpen source techSecurity and Trust CenterWEBINAR May 18 / 8 AM PT
Goodbye, Data Warehouse. Hello, Lakehouse.
Attend to understand how a data lakehouse fits within your modern data stack.
Register nowSolutionsSolutions by IndustryFinancial ServicesHealthcare and Life SciencesManufacturingCommunications, Media & EntertainmentPublic SectorRetailSee all IndustriesSolutions by Use CaseSolution AcceleratorsProfessional ServicesDigital Native BusinessesData Platform MigrationNew survey of biopharma executives reveals real-world success with real-world evidence.
See survey resultsLearnDocumentationTraining & CertificationDemosResourcesOnline CommunityUniversity AllianceEventsData + AI SummitBlogLabsBeaconsJoin Generation AI in San Francisco
June 26–29
 
Learn about LLMs like Dolly and open source Data and AI technologies such as Apache Spark™, Delta Lake, MLflow and Delta SharingExplore sessionsCustomersPartnersCloud PartnersAWSAzureGoogle CloudPartner ConnectTechnology and Data PartnersTechnology Partner ProgramData Partner ProgramBuilt on Databricks Partner ProgramConsulting & SI PartnersC&SI Partner ProgramPartner SolutionsConnect with validated partner solutions in just a few clicks.Learn moreCompanyCareers at DatabricksOur TeamBoard of DirectorsCompany BlogNewsroomDatabricks VenturesAwards and RecognitionContact UsSee why Gartner named Databricks a Leader for the second consecutive yearGet the reportTry DatabricksWatch DemosContact UsLoginJUNE 26-29REGISTER NOWHive Date FunctionAll>Hive Date FunctionTry Databricks for freeGet StartedWhat is a Hive Date Function?Hive provides many built-in functions to help us in the processing and querying of data. Some of the functionalities provided by these functions include string manipulation, date manipulation, type conversion, conditional operators, mathematical functions, and several others.Types of Built-in Functions in HIVEDate FunctionsMainly used to perform operations on date data types such as adding the number of days to the date or other similar operations.Mathematical FunctionsThese functions are primarily used to perform mathematical calculations.Conditional FunctionsThese functions are used to test conditions and returns a value based on whether the test condition is true or false.String FunctionsThese are used to perform operations on strings such as finding the length of a string etc.Collection FunctionsThese functions are used to find the size of the complex types like array and map. There is one collection function and that is SIZE. The SIZE function's main usage is to find the number of elements in an array and map.Type Conversion FunctionThis function's usage is to convert the data from one type to another. The only type conversion function is CAST.Table Generating FunctionsThese functions can be used to turn a single row into multiple rows. EXPLODE is the only table generated function. This function uses an array as an input and outputs the elements of the array into separate rows.Date TypesAre highly formatted; in their case, each date value contains the century, year, month, day, hour, minute, and second. These functions are used to perform operations on date data types like adding the number of days to the date, conversion of Date types from one type to another type etc. Below are the most commonly used Hadoop Hive DateTime functions:Function NameReturn TypeDescriptionUnix_TimestampBigIntIt will get current Unix timestamp in seconds.To_date(string timestamp)StringIt will fetch and give the date part of a timestamp string:year(string date)INTIt will fetch and give the year part of a date or a timestamp string.quarter (date/timestamp/string)INTThe function quarter was introduced in Hive 1.3, and it will fetch and give the quarter of the year for a date, timestamp, or string in the range 1 to 4month(string date)INTIt will give the month part of a date or a timestamp string.hour(string date)INTThe hour function will fetch and gives the hour of the timestampminute(string date)INTThis function will return  minute from the timestampDate_sub(string starting date, int days)stringThe DATE_SUB function subtracts the number of days to the specified dateCurrent_datedateIt will return the current date at the start of query evaluation.LAST _day(string date)stringIt will fetch and give the last day of the month which the date belongs totrunc(string date, string format)stringThis function strips off fields from a TIMESTAMP valueAdditional ResourcesExperiences Migrating Hive Workload to SparkSQLFunctions DocumentationBack to GlossaryProductPlatform OverviewPricingOpen Source TechTry DatabricksDemoProductPlatform OverviewPricingOpen Source TechTry DatabricksDemoLearn & SupportDocumentationGlossaryTraining & CertificationHelp CenterLegalOnline CommunityLearn & SupportDocumentationGlossaryTraining & CertificationHelp CenterLegalOnline CommunitySolutionsBy IndustriesProfessional ServicesSolutionsBy IndustriesProfessional ServicesCompanyAbout UsCareers at DatabricksDiversity and InclusionCompany BlogContact UsCompanyAbout UsCareers at DatabricksDiversity and InclusionCompany BlogContact UsSee Careers
at DatabricksWorldwideEnglish (United States)Deutsch (Germany)Français (France)Italiano (Italy)日本語 (Japan)한국어 (South Korea)Português (Brazil)Databricks Inc.
160 Spear Street, 13th Floor
San Francisco, CA 94105
1-866-330-0121© Databricks 2023. All rights reserved. Apache, Apache Spark, Spark and the Spark logo are trademarks of the Apache Software Foundation.Privacy Notice|Terms of Use|Your Privacy Choices|Your California Privacy Rights