# Automatic date time setter in XY chart

**URL:** <https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [April 18, 2023, 8:23am UTC](https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560 "2023-04-18T08:23:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chowmya\_C](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@Chowmya\_C](https://forum.inductiveautomation.com/u/Chowmya_C)\
**Post date:** [April 18, 2023, 8:23am UTC](https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560/1 "2023-04-18T08:23:26Z")

</div>

How to make present date and time setter in X axis of XY chart.  
Since, I've used this code  
date = system.date.getDate(2023, 4, 18)  
print system.date.setTime(date, 1, 37, 44)  
It's showing error.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 18, 2023, 8:37am UTC](https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560/2 "2023-04-18T08:37:38Z")

</div>

> [@Chowmya\_C](#):
>
> present date and time setter

What is a 'present date and time setter'?

> It's showing error.

What is showing error? Designer? Browser? Component? Script Console? What is the error message?

Post a cropped screen shot of what you are trying to do and show the problem.

---

<div class="post-metadata">

**Author:** ![Chowmya\_C](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@Chowmya\_C](https://forum.inductiveautomation.com/u/Chowmya_C)\
**Post date:** [April 18, 2023, 9:29am UTC](https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560/3 "2023-04-18T09:29:29Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b5e54d3394026f91c5f9b50b2eb342caf53785bc.png)

what's the method to pick the date and time in props.datasource.example

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 18, 2023, 10:04am UTC](https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560/4 "2023-04-18T10:04:31Z")

</div>

1. You can't write scripts in expression bindings. You can only use expressions. See [Expression Language and Syntax - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Expression+Language+and+Syntax).
2. The list of Expression Fuctions is here: [Expression Functions - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Expression+Functions)
3. You can't use the `=` assignment (but you can use it for comparison). Think of expressions as being like Excel formulas.
4. `Print` works in Script Console.
5. `system.date` functions are for Python scripting. They can't be used in expressions. See [System Functions - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/System+Functions).

Now for what you are trying to fix:  
Set `xAxes.0.date.format : yyyy-MMM-dd`.  
You don't need an expression.

> What's the method to pick the date and time in props.datasource.example?

You can't pick a date directly on the XY Chart.

---

<div class="post-metadata">

**Author:** ![Chowmya\_C](https://avatars.discourse-cdn.com/v4/letter/c/d78d45/32.png) [@Chowmya\_C](https://forum.inductiveautomation.com/u/Chowmya_C)\
**Post date:** [April 19, 2023, 1:55pm UTC](https://forum.inductiveautomation.com/t/automatic-date-time-setter-in-xy-chart/72560/5 "2023-04-19T13:55:12Z")

</div>

Ok, thanks
