Questions tagged as 'datetime'

1
answer

Format Unix Time to display only Data

Good afternoon, I'm having a problem where I need to remove the time or set the end time always to 23:59:59 if($form) { $start = new \DateTime($form['startDate']); $start = $start->format('U'); $end = new \DateT...
asked by 10.06.2014 / 20:38
2
answers

Exception with timestamp in the database

I want to separately insert the time and date into the database, which have the timestamp and data fields, respectively. And I have the following code to add the fields: sqlInsertCabecalho.Parameters.AddWithValue("@colaborador",...
asked by 22.04.2016 / 16:19
2
answers

Error formatting date:

Hello, I am formatting the date with the following code: Date data = null; SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { data = format.parse(request.getParameter("txtdata")); } catch (Exce...
asked by 27.05.2016 / 22:44
2
answers

Convert String with AM / PM to DateTime

I have a variable that contains a date with AM / PM: string data = "01/08/2016 9:00 PM"; When I try to convert to DateTime using the TryParse method, the result ignores the designator "AM / PM". string data = "01/08/2016 9:0...
asked by 31.08.2016 / 22:07
1
answer

How to configure ASP.NET MVC validation to accept dates pt-BR?

I can not set the formatting of dates on my forms. I've tried several cases, all using the same view: @Html.EditorFor(model => model.Data, new { htmlAttributes = new { @class = "form-control" } }) Case 1: Clean and raw public DateTim...
asked by 18.09.2015 / 21:17
2
answers

Problem with wrong time in PHP (America / Sao_Paulo)

I'm running an application running in a CentOS production environment with PHP and Apache updated. I noticed that CakePHP's logs return a wrong time from the one defined in php.ini and also set inside the application's Bootstrap by...
asked by 20.01.2015 / 18:37
2
answers

Search week number of the year through a date in C #

I'm writing a function that gets a string with a date (format dd/mm/aaaa ) and it should return a date in the same format 4 weeks later. Example: Entrada: 07/04/2016 saída: 05/05/2016 I read about it and thought of the following l...
asked by 07.04.2016 / 20:13
3
answers

Converting a datetime to text does not show the result

I have a date in this format: Quarta, 21 Maio, 2014 . To save this date in the database I'm converting it to datetime as follows: $f['data'] = $_POST['data']; $data = DateTime::createFromFormat('l, j F, Y', $f['data']); $data...
asked by 21.05.2014 / 21:11
1
answer

TimeZone from Brazil for DateTimeOffset C #

I would like to know what possible TimeZones are available for all regions of Brazil. I saw that we have E. South America Standard Time for Brasilia time, but for example, what would Timezone be in Acre?     
asked by 14.11.2018 / 18:49
1
answer

Subtract date from a DateTime [duplicate]

I need to get current date and subtract 3 months. It was doing conversions and subtracting 3 but going to go wrong at the turn of the year, in January for example it will result in month -2. I think there is a better way to do this.    ...
asked by 08.12.2017 / 13:52