---
title: "How can I make a column to be in timestamp?"  
description: "How can I make a column to be in timestamp?"  
author: "Sandra Emily"  
published: 2023-07-30  
updated: 2023-07-31  
canonical: https://www.mindstick.com/forum/159379/how-can-i-make-a-column-to-be-in-timestamp  
category: "mssql server"  
tags: ["mssql server", "sql server", "sql"]  
reading_time: 1 minute  

---

# How can I make a column to be in timestamp?

How can I make a [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) to be in [timestamp](https://www.mindstick.com/interview/791/what-does-timestamp-on-update-current_timestamp-data-type-do)?

## Replies

### Reply by Aryan Kumar

There are a few ways to make a column to be in timestamp. Here are some examples:

## In Excel:

1. Select the cell or range of cells that you want to convert to timestamps.
2. Press `Ctrl`+`Shift`+`;` to insert the current timestamp.
3. To format the timestamp, right-click on the cell or range of cells and select "Format Cells". In the "Format Cells" dialog box, select the "Date" category and then select the "Timestamp" format.

## In Python:

Python

```plaintext
import datetime

def make_timestamp(date_str, time_str):
  """Returns a timestamp from a date string and a time string."""
  date = datetime.datetime.strptime(date_str, "%Y-%m-%d")
  time = datetime.datetime.strptime(time_str, "%H:%M:%S")
  return datetime.datetime.combine(date, time)

timestamp = make_timestamp("2023-07-31", "01:54:15")
print(timestamp)
```

## In SQL:

SQL

```plaintext
CREATE TABLE my_table (
  id INT,
  timestamp TIMESTAMP
);

INSERT INTO my_table (id, timestamp) VALUES (1, CURRENT_TIMESTAMP);
```

In this example, the `CURRENT_TIMESTAMP` function returns the current timestamp.

Which method you use will depend on your specific needs and the programming language that you are using.


---

Original Source: https://www.mindstick.com/forum/159379/how-can-i-make-a-column-to-be-in-timestamp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
