<CFIF LookingAt IS "Week">
<CFSET Today = CreateDateTime(Year(Now()),Month(Now()),Day(Now()),0,59,0)>
<CFSET LastWeek = DateAdd("N",1,DateAdd("D",-7,Today))>
</CFIF>
I haven't tested this so there maybe small errors but something like this??
----- Original Message -----
From: ColdFusion Programmer
To: CF-Talk
Sent: Wednesday, July 30, 2003 12:24 PM
Subject: [cftalk] calculating the date and time.
How do I get the calculate the from time to start at 01:00 am and the to time to end
at 00:59 am. Can you please show me how to get the date and time in the format
mentioned below
In the last 7 days (23 Jul 2003 01:00 - 30 Jul 2003 00:59)
>> I was hoping somebody could help me. I'm trying to
>> display the date and time. This is how I want to
>> display it:
>>
>> If the current time is 10:05, I want to display the
>> time in this format:
>>
>> In the last hour (09:05 - 10:04)
>>
>> If the current time is 10:05 and the date is 30.July,
>> I want to display the date time in this format:
>>
>> In the last 24 hours (29 Jul 2003 10:00 - 30 Jul 2003
>> 09:59)
>>
>> If the current time is 10:05 and the date is 30.July,
>> I want to display the date time in this format:
>>
>> In the last 7 days (23 Jul 2003 01:00 - 30 Jul 2003
>> 00:59)
>>
>> If the current time is 10:05 and the date is 30.July,
>> I want to display the date time in this format:
>>
>> In the last 30 days (30 Jun 2003 01:00 - 30 Jul 2003
>> 00:59)
>
>Look into DateAdd() - you can add any amount of time to a date, from
>seconds to years
>
>If you want to remove 7 days, you can just do DateAdd("d", -7, Now())
>
>Hope this helps
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
http://www.cfhosting.com
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4