---
title: "How to convert timestamp into Date-Time format in Erlang?"  
description: "How to convert timestamp into Date-Time format in Erlang?"  
author: "Anonymous User"  
published: 2016-03-22  
updated: 2016-03-22  
canonical: https://www.mindstick.com/forum/34073/how-to-convert-timestamp-into-date-time-format-in-erlang  
category: "erlang"  
tags: ["erlang"]  
reading_time: 1 minute  

---

# How to convert timestamp into Date-Time format in Erlang?

I am a [beginner](https://www.mindstick.com/forum/23159/need-beginner-project-ideas) in Erlang programming. I have getting [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) [timestamp](https://www.mindstick.com/interview/791/what-does-timestamp-on-update-current_timestamp-data-type-do) [format](https://www.mindstick.com/forum/162083/how-to-convert-ost-files-into-pst-format) into [Date](https://yourviews.mindstick.com/story/3869/propose-day-2024-exciting-date-ideas-for-you-and-your-partner)-Time format. Can any one tell me how can I convert timestamp into Date-Time format?\
I want to convert {Year, Month, Day} format. please help me.

## Replies

### Reply by Tarun Kumar

If you want to change timestamp format like {Year, Month, Day}, then you can use this example:\
**I hope it will solve your problem:**\

```
timestampToDate(Milliseconds) ->  BDate = calendar:datetime_to_gregorian_seconds({{1995,1,1},{0,0,0}}),  Sec = BDate + (Milliseconds div 1000),  { Date,_Time} = calendar:gregorian_seconds_to_datetime(Sec),   Date.
```


---

Original Source: https://www.mindstick.com/forum/34073/how-to-convert-timestamp-into-date-time-format-in-erlang

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
