For the complete experience, please enable JavaScript in your browser. Thank you!

  • Creative Cloud
  • Photoshop
  • Illustrator
  • InDesign
  • Premiere Pro
  • After Effects
  • Lightroom
  • See all
  • See plans for: businesses photographers students
  • Document Cloud
  • Acrobat DC
  • eSign
  • Stock
  • Elements
  • Marketing Cloud
  • Analytics
  • Audience Manager
  • Campaign
  • Experience Manager
  • Media Optimizer
  • Target
  • See all
  • Acrobat Reader DC
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player
  • All products
  • Creative Cloud
  • Individuals
  • Photographers
  • Students and Teachers
  • Business
  • Schools and Universities
  • Marketing Cloud
  • Document Cloud
  • Stock
  • Elements
  • All products
  • Get Support
    Find answers quickly. Contact us if you need to.
    Start now >
  • Learn the apps
    Get started or learn new ways to work.
    Learn now >
  • Ask the community
    Post questions and get answers from experts.
    Start now >
    • About Us
    • Careers At Adobe
    • Investor Relations
    • Privacy  |  Security
    • Corporate Responsibility
    • Customer Showcase
    • Events
    • Contact Us
News
    • 3/22/2016
      Adobe Summit 2016: Are You An Experience Business?
    • 3/22/2016
      Adobe Announces Cross-Device Co-op to Enable People-Based Marketing
    • 3/22/2016
      Adobe and comScore Advance Digital TV and Ad Measurement
    • 3/22/2016
      Adobe Marketing Cloud Redefines TV Experience
CFML Reference / 

CreateDateTime

Adobe Community Help


Applies to

  • ColdFusion

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 

Description

Creates a date-time object.

Returns

A date/time value.

Category

Date and time functions

Function syntax

CreateDateTime(year, month, day, hour, minute, second)

History

Introduced in ColdFusion MX6.

See also

CreateDate, CreateTime, CreateODBCDateTime, Now; Evaluation and type conversion issues in Data type conversion in the Developing ColdFusion Applications

Parameters

Parameter

Description

year

Integer in the range 0-9999. Integers in the range 0-29 are converted to 2000-2029. Integers in the range 30-99 are converted to 1930-1999. You cannot specify dates before AD 100.

month

Integer in the range 1 (January) - 12 (December)

day

Integer in the range 1 - 31

hour

Integer in the range 0 - 23

minute

Integer in the range 0 - 59

second

Integer in the range 0 - 59

In Adobe ColdFusion (2016 release), you can use the CreateDateTime function in the following ways:

  • CreateDateTime(year)
  • CreateDateTime(year, month)
  • CreateDateTime(year, month, day)
  • CreateDateTime(year, month, day, hour)
  • CreateDateTime(year, month, day, hour, minute)
  • CreateDateTime(year, month, day, hour, minute, second)
Parameter Default value
Month 1
Day 1
Hour 0
Minute 0
Second 0

If you pass the parameter values only partially, other fields take the default value. For example, CreateDateTime(2016) produces '2016-01-01 00:00:00', where 2016 is the specified parameter and the rest are produced by default.

Example #1

<cfscript>
       // Create date time object and display it
       WriteOutput(CreateDateTime(2016,2,16,16,45,34) & " | "); // Create object for specified time
       WriteOutput(#now()#); // Create object for now()
</cfscript>

Output

{ts '2016-02-16 16:45:34'} | {ts '2016-03-14 13:15:31'}

Example #2

<cfscript>
       // In ColdFusion (2016 release), you can use the CreateDateTime in the following ways
       WriteOutput(CreateDateTime(2016) & " | ");
       WriteOutput(CreateDateTime(2016,6) & " | ");
       WriteOutput(CreateDateTime(2016,6,10) & " | ");
       WriteOutput(CreateDateTime(2016,6,10,17) & " | ");
       WriteOutput(CreateDateTime(2016,6,10,17,45) & " | ");
       WriteOutput(CreateDateTime(2016,6,10,17,45,38));
</cfscript>

Output

{ts '2016-01-01 00:00:00'} | {ts '2016-06-01 00:00:00'} | {ts '2016-06-10 00:00:00'} | {ts '2016-06-10 17:00:00'} | {ts '2016-06-10 17:45:00'} | {ts '2016-06-10 17:45:38'}

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Choose your region United States (Change)   Products   Downloads   Learn & Support   Company
Choose your region Close

Americas

Europe, Middle East and Africa

Asia Pacific

  • Brasil
  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Cyprus - English
  • Česká republika
  • Danmark
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Greece - English
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • Malta - English
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • Southeast Asia (Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam) - English
  • 台灣

Commonwealth of Independent States

  • Includes Armenia, Azerbaijan, Belarus, Georgia, Moldova, Kazakhstan, Kyrgyzstan, Tajikistan, Turkmenistan, Ukraine, Uzbekistan

Copyright © 2016 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

AdChoices