Link to home
Start Free TrialLog in
Avatar of Dusty
DustyFlag for United States of America

asked on

DateTime function question

If I have a dateTime field in MySQL database and is formatted like : 2014-03-30 02:00:00

but i only want to use the date portion, how would you extract that? code example appreciated!

Thanks!
SOLUTION
Avatar of Ganapathi
Ganapathi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
All about it here:
https://wikidocs.adDateTimeFormatobe.com/wiki/display/coldfusionen/
Read the comments some correction to the code.

And don't forget to replace the tag "todayDateTime" with the field name from sql
Avatar of Dusty

ASKER

Maybe I did not ask the question correctly.
I already have many records in my database with dateTime  field and they are formatted like:
2014-03-30 02:00:00
2013-05-03 06:00:00

I want to extract just the date portion and use that as a coldfusion variable.
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
While selecting the data from database, use the below function for the date column

DATE(date_column_name)

You will get yyyy-mm-dd
Avatar of Dusty

ASKER

Thank you! I have split the points.
#DateTimeFormat(SQLLabelName, "yyyy.MM.dd")#
This will mask out the date