Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date Picker question
#1
Hi,

I'm using your forum example "date picker" dialog, and have a question about ret value output formating.

Brief setup: Earlier in the larger macro, I get the current date in yyyyMMdd format via:

t.time("%Y%m%d")

in addition to the more standard "June 24, 2007" format ("tt")

...which covers most uses of the macro. But I also need to give the user the option to force another date instead, so I'm using the date picker to ensure I'll at least get a valid date inputed.

However, I need to get the output of the picker in this same "%Y%m%d" and standard formats so I can seamlessly swap these values instead the current date variables.

1. How/where in that example macro & dialog do I specify that I need "%Y%m%d" and the other format as well?

2. I'm only using the top control (drop down) in the example, so i got rid of the others in the dialog editor. I've still got extraneous code in the dialog and macro, but it all seems to work fine, wasn't sure if you could tell me which bits to cut out if I'm only using t_st1.

3. Is it possible to convert a string (say a yyyyMMdd "20070601") to a date in another format? (just curious for future use, don't waste a lot of time if it's too complicated...)


Thanks again!!

Steve
#2
1. When you have variable of DATE type, you can use it with str.time() as first argument.

DATE d
...
t.time(d "%Y%m%d")

2. Don't remember which is which. Remove code that is not using the control id that you need (eg 3).

3. Make the string to look like a standard date string (ie with / or ., depending on locale), and assign to a DATE variable (=). Then use str.time().
#3
Thanks for the clear explanations...got me past another roadblock that I couldn't get past using help/forum alone.

Cheers,

Steve


Forum Jump:


Users browsing this thread: 1 Guest(s)