Compare current date with DWfile.getCreationDate/Obj

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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:...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139