# ToDateTimeOffsetFromDateTime

| **Name**    | ***ToDateTimeOffsetFromDateTime***                                                                                                                                             |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Syntax      | ToDateTimeOffsetFromDateTime (Date dateTime, TimeSpan offset)                                                                                                                  |
| Purpose     | To return date time with offset value after conversion.                                                                                                                        |
| Description | Converts specified date time value to a date time with offset value.                                                                                                           |
| Return Type | DateTimeOffset                                                                                                                                                                 |
| Parameters  | <p>dateTime \[System.DateTime] – Date which will be converted to datetime with offset</p><p>offset \[System.TimeSpan] – Offset which will be added to datetime with offset</p> |

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/0%20\(2\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(2\).png)

**Example**

In this example, we will pass a date time value to the function transformation object using a *Variables* object.

Where,

*dateTime* = 07/18/2022 05:09:17 PM

*offset* = 4:00

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/1%20\(2\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(2\).png)

In the output window, you can see that the provided date time value has been converted to a date time offset value, of the specified *offset* value.

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/2%20\(2\)%20\(1\)%20\(1\)%20\(1\)%20\(1\)%20\(2\).png)
