Questions tagged [formatdatetime]
120 questions
18
votes
5 answers
Return dd-mm-yyyy from Date() object
Desired return value should be a string formatted as dd-mm-yyyy.
Im trying to give a format date dd-mm-yyyy to ISOString and adding GMT but the code gives me this format. How can i do?
new Date().toISOString()
.replace(/T/, ' '). // replace…

J.arc
- 237
- 1
- 2
- 13
17
votes
2 answers
Conversion with StrToDateTime and TFormatSettings does not work
This code should work in Delphi XE2, but it gives "not a valid date and time" error in StrtoDateTime conversion:
procedure TForm2.Button1Click(Sender: TObject);
var
s: string;
d: TDateTime;
FmtStngs: TFormatSettings;
begin
…

Moore
- 221
- 1
- 4
- 12
14
votes
6 answers
PHP Zend date format
I want to input a timestamp in below format to the database.
yyyy-mm-dd hh:mm:ss
How can I get in above format?
When I use
$date = new Zend_Date();
it returns month dd, yyyy hh:mm:ss PM
I also use a JavaScript calender to insert a selected date…

maniclorn
- 1,081
- 3
- 12
- 23
11
votes
1 answer
How to format date in JSTL
I have a loop that goes through all the news items we have on our site. One of the fields is date ${newsitem.value['Date']}, given in millliseconds. I'd like to display this date in month/day/year format on the webpage. I thought JSTL format tag,…

John Manak
- 13,328
- 29
- 78
- 119
9
votes
4 answers
How format date Carbon:now() in Laravel PHP
I tried
update(['access' => Carbon::now()->format('Y/m/d H:i:s')]);
it returned Y-m-d H:i:s

ThaiVD
- 117
- 1
- 1
- 3
8
votes
6 answers
Converting GETDATE() to Hijri date to yyyymmdd
I am trying to get the Hijri GETDATE() and convert it into this format yyyymmdd
I have already tried this script
SELECT CONVERT(VARCHAR(10), GETDATE(), 131)
but it gives me this format ( 16/06/1438 ) and what I actually need is (1438/06/16)

Hussein ALSHAMIRI
- 99
- 2
- 9
8
votes
5 answers
How to convert MySQL TIMESTAMP to date time in PHP
I have a MySQL DB table with a column named "timestamp", a type of timestamp, and attribute of on update CURRENT_TIMESTAMP and a default of CURRENT_TIMESTAMP.
If I add a record to the table, specifying other values, but not the timestamp, then the…

Toby
- 9,696
- 16
- 68
- 132
6
votes
1 answer
How to change timestamp format on rsyslog
I want to change the default timestamp format on rsyslog. Currently I am running on RHEL7.2. Syslog version 7.4.7. Now the default format is the following:
Mar 23 09:35:30 localhost DEB [9125:.:2] debug info
Inside rsyslog.conf I…

mr antoni
- 595
- 1
- 6
- 17
6
votes
1 answer
ISO 8601 format date for PostgreSQL
I have string containing an ISO 8601 formatted date-time value (ex: 2013-05-21T15:00:00+0200) and time zone (ex: Europe/Rome).
What is the best Postgres data type to represent this date format?

Safari
- 11,437
- 24
- 91
- 191
5
votes
1 answer
rails - get YYYY-MM-dd date format in string
I'm not sure why I can't figure this out it's so simple.
I'm trying to concatenate todays date in the format YYYY-MM-dd to a string and it doesn't work.
I've tried creating the date with now = Time.now.strftime("%Y-%m-%d")and concatenating it like…

Walker
- 1,127
- 15
- 39
5
votes
1 answer
JSTL fmt formatDate tag is passed as it is instead of the desired value
I am assigning the formatted date to an tag but instead of the formatted date, the jstl code is allocated to the textfield.

h-rai
- 3,636
- 6
- 52
- 76
4
votes
1 answer
How to use FormatDateTime to return a default date concatenated with current year?
I'm using Delphi 2007.
I need write a FormatDateTime function that always return 01/01/ to a TDateEdit box (DevExpress component) as EditValue.
I've already tried...
tcxDateEdit1.EditValue := FormatDateTime('01/01/'+…

MMalke
- 1,857
- 1
- 24
- 35
4
votes
2 answers
Convert timestamp to the formatted date time using C++
I can only use C++ standard library (C++14) to convert timestamp to the given format date-time. I new to C++ and I know that C++ doesn't support us a lot via a library like Java.
At a given date and time of 2011-03-10 11:23:56 in the Central…

Nguyễn Đức Tâm
- 1,017
- 2
- 10
- 24
4
votes
8 answers
Delphi Win API CreateTimerQueueTimer threads and thread safe FormatDateTime crashes
This is a bit of a long question, but here we go. There is a version of FormatDateTime that is said to be thread safe in that you use
GetLocaleFormatSettings(3081, FormatSettings);
to get a value and then you can use it like so;…

Bruce
- 440
- 1
- 12
- 19
3
votes
1 answer
Delphi XE2 FormatDateTime passing -693594
We have a bit of an issue here. We have upgraded from Delphi 2006 to Delphi XE2 and are in the process of converting our code.
The problem is, we use the value -693594 through our application and database records to represent no date (zero date). …

There is no spoon
- 1,775
- 2
- 22
- 53