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

DayofWeek varibles???

Participant ,
Jun 21, 2006 Jun 21, 2006

Copy link to clipboard

Copied

<cfset ydate = DateFormat(Now(), "mm/dd/yyyy")>

How do i access the day value of ydate????
TOPICS
Advanced techniques

Views

398

Translate

Translate

Report

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 , Jun 21, 2006 Jun 21, 2006
well, ydate will output like 6/21/2006 depending on what sort of day value you want...
eg
#DateFormat(ydate, 'DDDD')# will give you Wednesday
#DateFormat(ydate, 'DDD')# will give you Wed
#DateFormat(ydate, 'DD')# will give you 09 (if today was the ninth)
#DateFormat(ydate, 'D')# will give you 21
#Day(ydate)# will give you 21
#Dayofweek(ydate)# will give you 4
but, if you are going to be using it in your document i would just set another variable.
<cfset ydateDay = DateFormat(Now(), "d")>

hth
...

Votes

Translate

Translate
Participant ,
Jun 21, 2006 Jun 21, 2006

Copy link to clipboard

Copied

well, ydate will output like 6/21/2006 depending on what sort of day value you want...
eg
#DateFormat(ydate, 'DDDD')# will give you Wednesday
#DateFormat(ydate, 'DDD')# will give you Wed
#DateFormat(ydate, 'DD')# will give you 09 (if today was the ninth)
#DateFormat(ydate, 'D')# will give you 21
#Day(ydate)# will give you 21
#Dayofweek(ydate)# will give you 4
but, if you are going to be using it in your document i would just set another variable.
<cfset ydateDay = DateFormat(Now(), "d")>

hth

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 22, 2006 Jun 22, 2006

Copy link to clipboard

Copied

<cfset ydate = DateFormat(Now(), "mm/dd/yyyy")>
<cfset dayValue = listGetAt(ydate,2,"/")>
dayValue: <cfoutput>#dayValue#</cfoutput>

Votes

Translate

Translate

Report

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 ,
Jun 22, 2006 Jun 22, 2006

Copy link to clipboard

Copied

that is another way to do it...


BKBK, i have the coldfusion mx book by macromedia and it doesnt mention anything about requiring delimiters for the ListGetAt() function... it just says ListGetAt(List, Position)... do you know why this is? is it really

ListGetAt(List, Position, "delimeter") ??

Votes

Translate

Translate

Report

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
Community Expert ,
Jun 22, 2006 Jun 22, 2006

Copy link to clipboard

Copied

For almost all, if not all, the list functions that take a delimiter as argument, the default delimiter is usually a comma. There is an understanding that, in such cases, one may leave out the delimiter argument.

Hence, with a comma as list-delimiter, two arguments are sufficient for ListGetAt().

<cfset ydate = DateFormat(Now(), "mm,dd,yyyy")>
<cfset dayValue = listGetAt(ydate,2)>
dayValue: <cfoutput>#dayValue#</cfoutput>

However, in your case, the list-delimiter "/" is not a comma, and so must be explicitly stated.

Votes

Translate

Translate

Report

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 ,
Jun 22, 2006 Jun 22, 2006

Copy link to clipboard

Copied

> <cfset ydateDay = DateFormat(Now(), "d")>

Or even:

<cfset ydateDay = day(Now())>

--
Adam

Votes

Translate

Translate

Report

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 ,
Jun 22, 2006 Jun 22, 2006

Copy link to clipboard

Copied

LATEST
This is my cue to pipe up with "Livedocs is an invaluable resource if
you're just learning CF":

http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000555.htm

--
Adam

Votes

Translate

Translate

Report

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
Documentation