Getting the current Date and Time doesn't work

Hi

I need the current Time inside an NSDate.

It does work when i use this:


set av_currentDate to current application's NSDate's dateWithNaturalLanguageString_("Now")

However, it’s only the date that is correct, the time is set to 00:00:00.
I think the function date() would fit better, since it “Creates and returns a new date set to the current date and time.”

However, when i use this:


set av_currentDate to current application's NSDate's date()

the script converts it into a cursive blue date and { } for the brackets, and of course I do not get any date out of it.
I think it might have something to do that the AppleScript part bites the Obj-C part.

Anyway, how can i get the current date and time into an NSDate object?

Thanks a lot

Hi,

I guess there is a terminology clash with date, beacuse it’s a reserved word in AppleScript.
Try it with pipes


set av_currentDate to current application's class "NSDate"'s |date|()

It worked with the Pipes.


set av_currentDate to current application's NSDate's |date|()

A little less special chars used like this :slight_smile:

Vielen Dank :slight_smile: