---
title: "problem in work with dates in the following format"  
description: "problem in work with dates in the following format"  
author: "Rajesh Goswami"  
published: 2010-11-25  
updated: 2019-04-18  
canonical: https://www.mindstick.com/forum/115/problem-in-work-with-dates-in-the-following-format  
category: "php"  
tags: ["php"]  
reading_time: 1 minute  

---

# problem in work with dates in the following format

work with [dates](https://yourviews.mindstick.com/story/1513/7-zodiac-signs-astrology-dates-meanings-amp-compatibility) in the following [format](https://www.mindstick.com/forum/162083/how-to-convert-ost-files-into-pst-format): "Tuesday, February 14, 2006 @ 10:39 am", how can we [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) them to another format, that is easier to use? please give the example\

## Replies

### Reply by Amit Singh

The strtotime function can convert a string to a timestamp. A timestamp can be converted to date format. So it is best to store the dates as timestamp in the database, and just output them in the format you like.\
\
So let's say we have\
$date = "Tuesday, February 14, 2006 @ 10:39 am";\
In order to convert that to a timestamp, we need to get rid of the "@" sign, and we can use the remaining string as a parameter for the strtotime function.\
\
for example\

```
$date = "Tuesday, February 14, 2006 @ 10:39 am";$date = str_replace("@ ","",$date);$date = strtotime($date);
```

\
now $date is a timestamp\
and we can say:\
\
echo date("d M Y",$date);\
\
hi, rajesh check this sample\


---

Original Source: https://www.mindstick.com/forum/115/problem-in-work-with-dates-in-the-following-format

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
