Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Display Date Only - By Year

Participant ,
Mar 14, 2012 Mar 14, 2012

This is probably simple but I can't find a solution...

Maybe brain not in right place...

I have multiple dates... ie data entry on different dates...

And want to search these entries... And display only the year...

ie... Data entered in 2011 and 2012...

Want to display output of "2011" and "2012" to break down the dates...

cfquery name="staty" datasource="fpb">

select * from inspid

where inspectorid = #session.inspuser_id#

order by inspdate desc

cfquery>

Output - just the years - from multiple dates...

Seems simple - but I can't get it in my head...

Thx

1.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , Mar 15, 2012 Mar 15, 2012

Thanx for the sarcasim...

Yes I consider google my textbook...

Answer here...

<cfquery name="staty" datasource="fpb">

select distinct year(inspdate) AS yydate from inspid

where inspectorid = #session.inspuser_id#

</cfquery>

<cfoutput query=staty>

#yydate#

</cfoutput>

Coding was blurred in my head...

Translate
LEGEND ,
Mar 14, 2012 Mar 14, 2012

The way to select just the year portion of a date field depends on the type of db you are using.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 14, 2012 Mar 14, 2012

Using MS Access

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 15, 2012 Mar 15, 2012

Seriously, what's with all the people using Access lately? They giving away licences with Happy Meals or something?

"I can't find a solution" - How hard have you tried? Try Googling "Access date functions" - ah, there's a year() function. I wonder what that does...

Oh, and don't do "select *".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2012 Mar 15, 2012

"I can't find a solution" - How hard have you tried? Try Googling [...]

Wow.  Didn't know you could do that.

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 15, 2012 Mar 15, 2012
LATEST

Thanx for the sarcasim...

Yes I consider google my textbook...

Answer here...

<cfquery name="staty" datasource="fpb">

select distinct year(inspdate) AS yydate from inspid

where inspectorid = #session.inspuser_id#

</cfquery>

<cfoutput query=staty>

#yydate#

</cfoutput>

Coding was blurred in my head...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources