Question: I'm receiving dates from my database in the format `2018-08-08 15:38:48` however I want it to show `3:38 pm` instead. 

I'm just unsure when to make this change, can I change it while it is being posted? They are dates of messages being sent to a person.

**Current code:** 

```
<div v-for="messages in userMessages">
   <div class="date">
       {{ user.created_at }}
   </div>
</div>

```

**Output:**

```
2018-08-08 15:38:48

```

How do I transform the date in vue? (when it is in a v-for?)

Answer: 
Vue does not offer date formatting. You will need your own filter to format the date. Or you use a package like the following: <https://github.com/brockpetrie/vue-moment#readme>

```
<span>{{ someDate | moment("hh:mm a") }}</span>

```
Your datetime format is not the ISO standard we would like, but we'll live with it... When handling dates, it's a good practice to convert them to date objects as soon as you receive them. If they're arriving in JSON, you can do this with a reviver function as the second argument to JSON.parse(). Here is a reviver function that will do the job for you...

Then,at the point you need to display, you can format your time with toLocaleTimeString()

```js
function nReviver(key, value) {
        var a;
        if (typeof value === "string") {
            a = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d*)?$/.exec(value);
            if (a) {
                return new Date(a[0]);
            }
        }
        return value;
    }

    // do this when you receive your data from the server and all
    // dates, wherever they are in the JSON, will be converted to date objects
    var myObj = JSON.parse('{"myDate":"2018-08-08 15:38:48"}',nReviver)

    // ...then, when you want to display, format with toLocaleTimeString()
    console.log(
      myObj.myDate.toLocaleTimeString({},{
        hour12:true,
        hour:'numeric',
        minute:'numeric'
      })
      .toLowerCase()
    )
```