# Cant convert timestamp field from text to date

**URL:** <https://discuss.elastic.co/t/cant-convert-timestamp-field-from-text-to-date/326158>\
**Category:** Kibana\
**Created:** [February 22, 2023, 10:36am UTC](https://discuss.elastic.co/t/cant-convert-timestamp-field-from-text-to-date/326158 "2023-02-22T10:36:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dor\_Steinberg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dor_steinberg/32/116235_2.png) [@Dor\_Steinberg](https://discuss.elastic.co/u/Dor_Steinberg)\
**Post date:** [February 22, 2023, 10:36am UTC](https://discuss.elastic.co/t/cant-convert-timestamp-field-from-text-to-date/326158/1 "2023-02-22T10:36:30Z")

</div>

hello everyone,  
i got problem converting log.timestamp field from text to date  
someone can help me understand what am i doing wrong?

i also will appreciate if do you have an idea of getting the day of the week from this timestamp (log.timestamp), i think after i will accomplish to convert to date type it will be more sense:)  
like (sunday,monday...)

here is my conf file from logstash  
---------------------conf file---------------------------------

input {  
jdbc {  
jdbc\_connection\_string =\> "jdbc:sqlserver://10.211.2.9:1433;databaseName=SNJ\_CAP\_CBM;integratedSecurity=false;encrypt=false;trustServerCertificate=true;"  
jdbc\_user =\> "SO"  
jdbc\_password =\> "1234"  
jdbc\_driver\_library =\> "/etc/logstash/conf.d/logstash-core/lib/jars/mssql-jdbc-11.2.0.jre8.jar"  
jdbc\_driver\_class =\> "com.microsoft.sqlserver.jdbc.SQLServerDriver"  
statement =\> "select datepart(weekday,substring(JSON\_VALUE(payload,'$.log.timestamp'),1,len(JSON\_VALUE(payload,'$.log.timestamp'))-3)) as Day, payload from dbo.tbl\_partly\_log"  
}  
}  
filter {  
json {  
source =\> "payload"  
}  
grok {  
match =\> { "[log][timestamp]" =\> "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY}%{GREEDYDATA}" }  
}  
date {  
match =\> ["[log][timestamp]", "YYYY-MM-dd HH:mm:ss.SSSSSS"]  
target =\> "[log][timestamp]"  
}  
}  
output {  
stdout {  
codec =\> rubydebug{}  
}  
elasticsearch {  
hosts =\> ["[https://10.211.3.164:9200](https://10.211.3.164:9200)"]  
index =\> "cbm-log"  
user =\> "elastic"  
password =\> "jSDE58rJj8I7BhyJCs-c"  
ssl =\> true  
ssl\_certificate\_verification =\> false  
cacert =\> "/etc/logstash/http\_ca.crt"  
doc\_as\_upsert =\> true

## } }

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 22, 2023, 10:36am UTC](https://discuss.elastic.co/t/cant-convert-timestamp-field-from-text-to-date/326158/2 "2023-03-22T10:36:47Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
