Hi again friends.
UPDATED!!
In the first i was explaining wrong. Sorry for that.
Now is it correct
I have trided to solve this problem, but i need your help now.
This is an example. I real i have more data and i will explain more about this
| ID | Date | How i want it | Time |
|---|---|---|---|
| 1 | 2022-01-01 | 2022-01-01 | 00:00 |
| 1 | 2022-01-01 | 2022-01-01 | 01:00 |
| 1 | 2022-01-01 | 2022-01-01 | 02:00 |
| 1 | 2022-01-01 | 2022-01-01 | 03:00 |
| 1 | 2022-01-01 | 2022-01-01 | 04:00 |
| 1 | 2022-01-01 | 2022-01-01 | 05:00 |
| 1 | 2022-01-01 | 2022-01-02 | 00:00 |
| 1 | 2022-01-01 | 2022-01-02 | 01:00 |
| 1 | 2022-01-01 | 2022-01-02 | 02:00 |
| 1 | 2022-01-01 | 2022-01-02 | 03:00 |
| 1 | 2022-01-01 | 2022-01-02 | 04:00 |
| 2 | 2022-05-01 | 2022-05-01 | 03:00 |
| 2 | 2022-05-01 | 2022-05-01 | 04:00 |
| 2 | 2022-05-01 | 2022-05-01 | 05:00 |
| 2 | 2022-05-01 | 2022-05-01 | 06:00 |
| 2 | 2022-05-01 | 2022-05-01 | 07:00 |
| 2 | 2022-05-01 | 2022-05-02 | 00:00 |
| 2 | 2022-05-01 | 2022-05-02 | 01:00 |
| 2 | 2022-05-01 | 2022-05-02 | 02:00 |
| 2 | 2022-05-01 | 2022-05-02 | 03:00 |
My Time Column has value from 00:00 - 23:00
And all this data is hold in data table.
I want to increment the Date every time Column “Time” = 00:00
And when there is a new ID i want it to start from that Date.
I hope its understanble in the example.
I have tried this code below, but that is not working like i want
For Each row in dataTable
If row(“Hour”).ToString = “00”
Assign previousDate = DateTime.Parse(row(“Date”).ToString).AddDays(1)
Else
Assign previousDate = DateTime.Parse(row(“Date”).ToString)
End If
Assign row(“Date”) = previousDate.ToString(“yyyy-MM-dd”)
End For Each
Big thanks
Anders
