# Date -format Info In Expressions?

**URL:** https://forum.highend3d.com/t/date-format-info-in-expressions/1217
**Category:** Maya
**Tags:** mel
**Created:** [January 1, 2009, 5:28pm UTC](https://forum.highend3d.com/t/date-format-info-in-expressions/1217 "2009-01-01T17:28:53Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![smeghead](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@smeghead](https://forum.highend3d.com/u/smeghead)
#### Post date: [January 1, 2009, 5:28pm UTC](https://forum.highend3d.com/t/date-format-info-in-expressions/1217/1 "2009-01-01T17:28:53Z")

</div>

Hi all. First off, _put hands up_ Im a complete noob so go easy on me. ![]()

I have a quick question. When you want to use expressions in script editor, how do you get information thats like date -format?

For example, Ive got this which is a part of a clock:

CODE  
//Used to set the minute hand position.

int $minute = `date -format "mm"`;  
int $rotateMinute = $minute \* -6;  
setAttr "minuteHand.rotateZ" $rotateMinute;

The expression is where Im struggling.

CODE  
//Expression which makes the minute hand move.

expression -o minuteHand -s "minuteHand.rotateZ = $rotateMinute + (time / -10)";

^This is what I want, but the syntax is wrong because of $rotateMinute. It works without a procedure, but with a procedure it doesnt work.

So my question is, how can I replace $rotateMinute in the expression to have real life minutes or is there a way for the expression to access $rotateMinute? Thanks in advance.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 1, 2009, 6:52pm UTC](https://forum.highend3d.com/t/date-format-info-in-expressions/1217/2 "2009-01-01T18:52:11Z")

</div>

Well simply put you don't. Theres no sane reason to do this but just for humor you could do:

CODE  
expression -o minuteHand -s "minuteHand.rotateZ =((int)`date -format \"mm\"` )";

But i think you meant to do:

QUOTE  
expression -o minuteHand -s ("minuteHand.rotateZ = "+$rotateMinute +"+ (time / -10)");

QUOTE  
^This is what I want, but the syntax is wrong because of $rotateMinute. It works without a procedure, but with a procedure it doesnt work.

Your example contains no single procedure.

---

<div class="post-metadata">

### Author: ![joojaa](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@joojaa](https://forum.highend3d.com/u/joojaa)
#### Post date: [January 1, 2009, 6:54pm UTC](https://forum.highend3d.com/t/date-format-info-in-expressions/1217/3 "2009-01-01T18:54:13Z")

</div>

Well simply put you don't. Theres no sane reason to do this but just for humor you could do:

CODE  
expression -o minuteHand -s "minuteHand.rotateZ =((int)`date -format \"mm\"` )";

or

expression -o minuteHand -s ("minuteHand.rotateZ = "+`date -format \"mm\"` +"+ (time / -10)");

But i think you meant to do:

QUOTE  
expression -o minuteHand -s ("minuteHand.rotateZ = "+$rotateMinute +"+ (time / -10)");

QUOTE  
^This is what I want, but the syntax is wrong because of $rotateMinute. It works without a procedure, but with a procedure it doesnt work.

Your example contains no single procedure.

---

<div class="post-metadata">

### Author: ![smeghead](https://forum.highend3d.com/letter_avatar_proxy/v4/letter/s/f1d935/32.png) [@smeghead](https://forum.highend3d.com/u/smeghead)
#### Post date: [January 1, 2009, 7:12pm UTC](https://forum.highend3d.com/t/date-format-info-in-expressions/1217/4 "2009-01-01T19:12:04Z")

</div>

Ohhh! I tried something similar to that but my noobishness meant syntax errors. ![]()

It works like a charm. Thank you Joojaa, hugely appreciate it!
