# How to Format the Date

**URL:** <https://forum.phpvms.net/t/how-to-format-the-date/2261>\
**Category:** phpVMS Legacy Support (v2/v5)\
**Created:** [March 21, 2010, 6:33am UTC](https://forum.phpvms.net/t/how-to-format-the-date/2261 "2010-03-21T06:33:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![piper338](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@piper338](https://forum.phpvms.net/u/piper338)\
**Post date:** [March 21, 2010, 6:33am UTC](https://forum.phpvms.net/t/how-to-format-the-date/2261/1 "2010-03-21T06:33:56Z")

</div>

Howdy again,

I am trying to use echo $userinfo-\>joindate in my pilot center is returns a result like… 2010-02-10 23:15:50

How can I format it to return 2/10/2010?

Thanks,

Chad C.

---

<div class="post-metadata">

**Author:** ![piper338](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@piper338](https://forum.phpvms.net/u/piper338)\
**Post date:** [March 21, 2010, 6:53am UTC](https://forum.phpvms.net/t/how-to-format-the-date/2261/2 "2010-03-21T06:53:48Z")

</div>

> Howdy again,
> 
> I am trying to use echo $userinfo-\>joindate in my pilot center is returns a result like… 2010-02-10 23:15:50
> 
> How can I format it to return 2/10/2010?
> 
> Thanks,
> 
> Chad C.

Ok, I tried the following and it returns 12/31/1969 this is the right format but the wrong date… I’ll keep trying.

\<?php echo date(‘m/d/Y’, $userinfo-\>joindate); ?\>

---

<div class="post-metadata">

**Author:** ![simpilot](https://forum.phpvms.net/user_avatar/forum.phpvms.net/simpilot/32/26_2.png) [@simpilot](https://forum.phpvms.net/u/simpilot)\
**Post date:** [March 21, 2010, 11:56am UTC](https://forum.phpvms.net/t/how-to-format-the-date/2261/3 "2010-03-21T11:56:37Z")

</div>

Try -\>

```
<?php echo date(DATE_FORMAT, strtotime($userinfo->joindate)); ?>

```

That should output it in the format that is defined in you admin settings.

---

<div class="post-metadata">

**Author:** ![TennShadow](https://forum.phpvms.net/user_avatar/forum.phpvms.net/tennshadow/32/16_2.png) [@TennShadow](https://forum.phpvms.net/u/TennShadow)\
**Post date:** [March 21, 2010, 4:23pm UTC](https://forum.phpvms.net/t/how-to-format-the-date/2261/4 "2010-03-21T16:23:12Z")

</div>

> Try -\>
> 
> \<?php echo date(DATE\_FORMAT, strtotime($userinfo-\>joindate)); ?\>
> 
> That should output it in the format that is defined in you admin settings.

That worked…

Thanks!

---

<div class="post-metadata">

**Author:** ![piper338](https://forum.phpvms.net/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@piper338](https://forum.phpvms.net/u/piper338)\
**Post date:** [March 21, 2010, 9:07pm UTC](https://forum.phpvms.net/t/how-to-format-the-date/2261/5 "2010-03-21T21:07:49Z")

</div>

> Try -\>
> 
> \<?php echo date(DATE\_FORMAT, strtotime($userinfo-\>joindate)); ?\>
> 
> That should output it in the format that is defined in you admin settings.

Yup that worked thanks!

Chad C.
