Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
Jammer #1
Compare current date with DWfile.getCreationDate/Obj
Hey everyone!
I have a new questions. I was curious if anyone already has a created function
that will convert e current date into the hex format of: DWfile.getCreationDate
or the extended format of: DWfile.getCreationDateObj
I need to compare the two dates. I know htere is a way to do it without having
to get legnth and then getlastindex of etc....
So if there is already a function or would like to help me create one please
let me know. Here is my code for getting the current date inside of DW.
var tmpDate = new Date();
var month = String((tmpDate.getMonth())+1);
var day = String(tmpDate.getDate());
var year = String(tmpDate.getYear());
findObject('currDate').innerHTML=(year+month+day);
Thanks!
Jammer Guest
-
date compare
Use the datecompare() function to see if they are equal: datecompare(date1,date2,'d') You can use the dateadd() function to add days to a date:... -
compare a date in db field to today
Hi I have a date field in Access that I want to return if the date is less than 30 days old. i have built this query, but I'm not using the... -
compare date on cd to system date
Can someone please help me with the code to compare the date written in a text file (in root of CD ROM) with the system date. If the text file date... -
compare date,time
Hi, I have the following 12/08/2003, 11:00 13/08/2003, 23:00 Now I would like to compare them and then calculate the how long time was... -
Compare Date problem
I have 3 integer columns in my table, which represents the date of entry: dayEntry monthEntry yearEntry How can I combine this 3 columns to... -
Jammer #2
Re: Compare current date with DWfile.getCreationDate/Obj
Well, I decided to create my own: Check it out..
function dissectDateObj(){
var fromPath = dw.getUserConfigurationPath() + '/shared/fm3/';
var currentDate = String(DWfile.getCreationDateObj(fromPath))
var dateLength = currentDate.length
var monthNames = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec';
var temp = new Array();
temp = currentDate.split(' ');
var objMonth = String(temp[1])
var objDay = String(temp[2])
var objYear = String(temp[8])
var temp2 = new Array();
temp2 = monthNames.split(',');
for (i=0; i<=13; i++){
if(objMonth==temp2){
var convertMonth = i+1;
if (convertMonth.length==1){
formattedMonthObj = ("0"+convertMonth)
}else{
formattedMonthObj = convertMonth
}
}
}
if (objDay.length==1){
formattedDayObj = ("0"+objDay)
}else{
formattedDayObj = objDay
}
var formattedDateObj = (objYear+formattedMonthObj+formattedDayObj);
alert(formattedDateObj);
}
Jammer Guest
-
T.Pastrana - 4Level #3
Re: Compare current date with DWfile.getCreationDate/Obj
Getting an error on two things. You need to declare your formattedMonthObj
variable. Just place it anywhere before your conditions that set it.
var formattedMonthObj;
... also I believe you need to add an array entry association to the temp2
array.
FROM THIS
if(objMonth==temp2){
TO THIS
if(objMonth==temp2[i]){
It seems to work fine though.
--
Regards,
...Trent Pastrana
[url]www.fourlevel.com[/url]
"Jammer" <webforumsuser@macromedia.com> wrote in message
news:diksnc$l50$1@forums.macromedia.com...> Well, I decided to create my own: Check it out..
>
> function dissectDateObj(){
> var fromPath = dw.getUserConfigurationPath() + '/shared/fm3/';
> var currentDate = String(DWfile.getCreationDateObj(fromPath))
> var dateLength = currentDate.length
> var monthNames = 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec';
> var temp = new Array();
> temp = currentDate.split(' ');
> var objMonth = String(temp[1])
> var objDay = String(temp[2])
> var objYear = String(temp[8])
> var temp2 = new Array();
> temp2 = monthNames.split(',');
> for (i=0; i<=13; i++){
> if(objMonth==temp2){
> var convertMonth = i+1;
> if (convertMonth.length==1){
> formattedMonthObj = ("0"+convertMonth)
> }else{
> formattedMonthObj = convertMonth
> }
> }
> }
> if (objDay.length==1){
> formattedDayObj = ("0"+objDay)
> }else{
> formattedDayObj = objDay
> }
> var formattedDateObj = (objYear+formattedMonthObj+formattedDayObj);
> alert(formattedDateObj);
> }
>
T.Pastrana - 4Level Guest
-
Jammer #4
Re: Compare current date with DWfile.getCreationDate/Obj
Ok.... I just realized a huge lapse in my logic:
So please help me rethink this.
I am trying to create a trial that expires after 15 days.
Thus I am comparing the date an object was created + 15 days with todays date.
How can this be done?
Any thoughts would be great!
Jammer Guest
-
Jammer #5
Re: Compare current date with DWfile.getCreationDate/Obj
Ok... found the answer.... I added the following function:
function addDays(myDate,days) {
return new Date(myDate.getTime() + days*24*60*60*1000);
}
and changed the following varible from what it is above to:
var tmpDate = addDays(new Date(),15);
Jammer Guest



Reply With Quote

