short date condition

Unanswered Question
Mar 18th, 2010
User Badges:

Hi,


I've this condition: If (date.after(D[19 de marzo de 2010 00:00:00]) && date.before(D[7 de mayo de 2010 00:00:00]) ) Then.

But i want ask without the year and time, how can i do?


Thanks!!


Emilio

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Anthony Holloway Thu, 03/18/2010 - 09:40
User Badges:
  • Purple, 4500 points or more

Take a look at the UCCX Scripting and Development Series: Volume 3, Expression Language Reference Guide


There is a section on Date literals, and it shows you the valid formats.


I have quoted a portion of the document here for quick review:



Example Date Literals:

     D[12/13/52]

     D[Dec 13, 1952]

     D[Thu, July 4, 2002]

     D[July 5, 2002]

     D[July 7, 2002]

     D[7/6/02]

     D[Thu, July 4, 2002 5:59 PM]

     D[July 5, 2002 5:59 PM]

     D[July 7, 2002 5:59 PM]

     D[7/6/02 5:59 PM]

     D[Thu, July 4, 2002 12:23:59 AM]

     D[July 5, 2002 12:23:59 AM]

     D[July 7, 2002 12:23:59 AM]

     D[7/6/02 12:23:59 AM]

     D[Thu, July 4, 2002 12:23:59 AM CST]

     D[July 5, 2002 12:23:59 AM CST]

     D[July 7, 2002 12:23:59 AM CST]

     D[7/6/02 12:23:59 AM CST]

     D[now]

emilio.pacheco Mon, 03/22/2010 - 01:31
User Badges:

Hi Anthony,



But i don't want control the year, i only want control day and month, how can i do?


Thanks!


Emilio

Anthony Holloway Mon, 03/22/2010 - 08:14
User Badges:
  • Purple, 4500 points or more

Oh I see, so you were not asking what the valid formats are, you were asking how to compare two dates, without considering the year and time?


You can compare parts of the date like this:



if (d[now].month >= d[February 1, 2010].month)

     /* The current month is, or is after February */

} else {

     /* The current month is before February */

}



And dates are accessed like this:


d[now].date


Message was edited by: Anthony Holloway - Typo on February...corrected now.

emilio.pacheco Mon, 03/22/2010 - 09:20
User Badges:

Hi,


I'm trying to write this:

date.month >= date[Febraury 1, 2010].month

but send me an error when i click in Apply... i use variable date, where date = D[now]

The error is "Unable to parse expression; Couldn't repair and continue parsing on token #INTEGER "1" (line: 1, col:30)" and refer with the day


Regards,

emilio.pacheco Tue, 03/23/2010 - 01:36
User Badges:

Hi,


With d[now] neither work, i've the error "Unparseable date: "Febraury 1, 2010"

What version have you got? i've 5.0


Thanks!


Regards,


Emilio

e.gailiss Tue, 03/23/2010 - 01:58
User Badges:

Hi ,


What exactly are you writing?


It should look like D[now].date or D[now].month


Ervins

emilio.pacheco Tue, 03/23/2010 - 03:14
User Badges:

Hi,


I'm writing exactly that Anthony told me:


d[now].month >= d[Febraury 1, 2010].month



Emilio

Anthony Holloway Tue, 03/23/2010 - 08:12
User Badges:
  • Purple, 4500 points or more

I spelled February wrong, and you copied my mistake.  sorry. 

Actions

This Discussion