Get Date Value as DD/MM/YYYY from database - asp.net

I am using the "[Datatype(Datatype.date)" data annotation for allowing the user to select the date and it's selected in this format, "DD/MM/YYYY".
However, the date is sent backwards to the database. The image below illustrates this.
Any ideas? Thanks in advance.
Correct date selected
Backwards date sent to data

Ended off using Moment which is amazing at formatting dates.

Related

How to stop Time data being appended to Today() (powerapps and excel)

I am trying to use powerapps to create a submission form for users.
The issue is that I have one field for submission date.
All I want is the short date added to the table column when the user clicks submit.
What I get is the shortdate with
YYYY-MM-DDTHH:MM:SS.SSOZ
I have tried:
Text(Today(), "[%-en-US]YYYY-MM-DD")
Text(Today(), DateTimeFormat.ShortDate)
Left(Text(Today(), "[%-en-US]YYYY-MM-DD"),10)
Left(Text(Today(), DateTimeFormat.ShortDate),10)
I have tried setting the excel table field to "Text"
I have tried setting it back to date and using just the short date without conversion.
Is there any end to this madness?
Thanks!
Text(Today(),DateTimeFormat.ShortDate)
This should do the trick;
DateValue(Text(Now()))

Metabase displays wrong time format

My Data are stored in a MySql Database and i use Metabaseto display the data.
In phpMyAdmineverything looks like it should, but in Metabase the Dates are displayed like they should. The two datetimes types do not really matter but the time type looks like a date altough it's a time.
What can i do so that the time is displayed correctly?
Table Structure:
Table Data:
Metabase:
Try to force date format using DATE_FORMAT/TIME_FORMAT in the output fields list:
DATE_FORMAT(started, '%Y-%m-%d %H:%i:%s') as started,
TIME_FORMAT(testDuration, '%H:%i:%s') as testDuration
Instead of hard coding something, there is a wheel setting button that you can change the format for timing...
and then -->:

How to get date from datetime in crystal report?

I have the datetime format in my sqldatabase was "2012-07-21 00:00:00.000". I need the date(21) only. Am trying to convert but it was showing database error for this particular field.
My Code is:
DatePart('d',CDate({tblFiles.Filed_Date}));
It's a problem with the connection of your report to the database. Make sure to set the data source correctly. You may start by verifying the report.
Okay I had this problem in the past, which is dealt with some bits of conversions, here is an example to how I dealt with this issue, here I did not have date but I had time in my database, you need to convert it to text and replace the number of zeros you see and display x as Date(x); and then right click the field and format it to just get the data, by right clicking it. hope this helps.
LOCAL STRINGVAR x := REPLACE(totext({DETAILED_FOR_EMPLOYEE.LOGIN_TIME}), '.0000000', '')

Control input of SQLite attribute to date format only.

I have been reading all about converting TEXT fields into date formats and ways to use Python to create date objects but my question remains.
My table has a dateTime column that is specified as TEXT, I would like to build a constraint that forces input to be in dateTime format, but as SQLite doesn't do dates (as I would like) I haven't worked out how to do it.
My current ideas: 1. Limit number of characters
2. Set separate attributes for day, month and year and constrain their domains
3. It is silly to do this on the database side just do it in the user interface
I would appreciate your opinions on these or other options.
Thanks :)
I've been trying to solve the same issue and the method I came up with was to use the date/time functions to parse the value and check that it hasn't changed. Essentially the following:
CREATE TABLE dts_test (
dts TEXT CHECK (dts IS datetime(dts))
);
If the default format is not what you want you can use the strftime or similar to design whatever format you want, but it must be something that the built-in date and time functions can parse.

MS InfoPath: How do you populate a date box by using a function? Mostly a formatting date issue

This might be a simple question. But I am trying to use a rule in an InfoPath field where if a user enters a certain value in a text box, a date box will populate with a certain date.
Example: User enters "Orange" in the Textbox1 field. Datefield1 should populate with 11/30/2010.
The problem is I have no idea how to setup/format the date in the rule box. See picture for details.
InfoPath marks the format as invalid. I've tried 2011-Nov-30, 30-Nov-2011, and a few more. Any ideas?
It has to be the date format yyyy-mm-dd ("2010-01-01"). Alternatively you can use the date function today() if it is always going to be the current date.

Resources