HPlogo ALLBASE/SQL Reference Manual: HP 9000 Computer Systems > Chapter 8 Expressions

Current Functions

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Current functions return a value that represents a current DATE, TIME, or DATETIME. The value returned is a string with the format of a DATE, TIME, or DATETIME data type.

Scope

SQL Data Manipulation Statements

SQL Syntax

  {CURRENT_DATE
   CURRENT_TIME
   CURRENT_DATETIME}

Description

  • CURRENT_DATE returns the current date as a string of the form 'YYYY-MM-DD', where YYYY represents the year, MM is the month, and DD is the day.

  • CURRENT_TIME returns the current time as a string of the form 'HH:MI:SS', where HH represents hours, MI is minutes, and SS is seconds.

  • CURRENT_DATETIME returns the current date and time as a string of the form 'YYYY-MM-DD HH:MI:SS.FFF', where YYYY represents the year, MM is the month, DD is the day, HH represents the hours, MI the minutes, SS the seconds, and FFF the thousandths of a second.

Examples

Set a column to the current DATE.

   UPDATE ManufDB.TestData
      SET TestDate = CURRENT_DATE
    WHERE BatchStamp = '1984-07-25 10:15:58.159'

Set a column to the current DATETIME.

   UPDATE ManufDB.SupplyBatches
      SET BatchStamp = CURRENT_DATETIME
    WHERE BatchStamp = '1984-07-25 10:15:58.159'
Feedback to webmaster