Questions tagged [date-manipulation]

90 questions
0
votes
1 answer

How to set the time in MS since 1970 to a Datetime(6) field in MySQL

I have a Java application where I get a timestamp with the call System.currentTimeInMills(); This returns values like 1331255526000. Now I want to store these values in a MySQL database in a Datetime(6) field and I've written the following…
Fischer Ludrian
  • 629
  • 1
  • 9
  • 23
0
votes
2 answers

Using SQL DateAdd algorithm, excluding weekends

I need to write a simple query that returns three weekdays prior to a given date. I don't want to create a calendar table. Is there an algorithm that uses dateadd() and datepart() that i can use to get this result?
FistOfFury
  • 6,735
  • 7
  • 49
  • 57
0
votes
0 answers

In MySQL, somedate - otherdate returns.. what?

I'm just curious because most DBs I ever worked with, when tasked with SOMEDATE - ANOTHERDATE return the difference in days between the two dates MySQL seems to return a number that is.. er.. I've no idea. Sometimes it's the seconds. Sometimes it's…
Caius Jard
  • 72,509
  • 5
  • 49
  • 80
-1
votes
1 answer

Why am I not getting an exact time when adding days to a time?

In .NET Core 6 I am getting a funny result when adding days, and it only happens in one project but not in another. var time = 3.2986111640930176; var firstDate = new DateTime(2023, 7, 1); var newDate = firstDate.AddDays(time); var ticks =…
Shumii
  • 4,529
  • 5
  • 32
  • 41
-1
votes
1 answer

In Google Sheets I am trying to compute room occupancy per month from a list of dates

I have found numerous ways of getting parts of the result, but I'm obviously lacking in-depth knowledge of the various functions to arrive at what I need. Sample data: arrival | departure 11/25/2022 11/28/2022 11/30/2022 12/10/2022 12/25/2022…
-1
votes
1 answer

How to parse the date for February and months with 31 days?

I thank you for possible answers. The problem is, I work with a legacy system with Java 1.4. In a registration form you have the following fields: 'Period' in the mm / yyyy format 'Expiration Day' Concatenate the day with the period and parse for…
marcioasan
  • 11
  • 2
-1
votes
1 answer

How to get +15 minutes date time in Javascript with dd/mm/yyyy hh:ii AM/PM format?

I have to get +15 minutes date time in Javascript with dd/mm/yyyy hh:ii AM/PM format. And I should compare two dates, which are in dd/mm/yyyy hh:ii AM/PM format. JS: var date = new Date(); var hours = date.getHours(); var minutes =…
Rajasekhar
  • 37
  • 1
  • 6
-1
votes
2 answers

Java date-manipulation

I'm trying to get a date with a Month number, week of month number and a day of week number I thought this will be easy and did this: LocalDate nextbookingDate = LocalDate.now().plusYears(1); nextBookingDate =…
Leon
  • 5
  • 5
-1
votes
5 answers

Convert String to Date and remove day value (always set 1 day of month)

I can convert a String to a Date: private static final SimpleDateFormat CARD_DATE_FORMAT = new SimpleDateFormat("yyMMdd", Locale.getDefault()); public static Date toCardDateFormat(String date){ try { return…
ip696
  • 6,574
  • 12
  • 65
  • 128
-2
votes
3 answers

Java LocalDate How to utilize

input list from date ex) 2020-10-01 to date ex) 2020-10-30 List [day of week] ex) [sun,mon....] List [week] ex) [1,4,5] I would like to know how to get a specific day of the week…
sc m
  • 13
  • 2
-2
votes
2 answers

Determine Date This Year Based off Future Date

A bit of an odd business request just came up. We have contracts that span multiple years. The system maintains the contract's End Date. I have to determine the End Date's same calendar date, but for the current year if it hasn't passed this year,…
HardCode
  • 6,497
  • 4
  • 31
  • 54
-2
votes
1 answer

I want to print last month last date with time stamp '23:59:59' using command

Below is my output but I want to get output like Apr 30 23:59:59. Please suggest date -d "$(date +%Y-%m-01) -1 day" Output: Tue Apr 30 00:00:00 UCT 2019 I want output: Tue Apr 30 23:59:59 UCT 2019
-2
votes
2 answers

Convert date time to day zero php

one question to converting datetime type from mysql which range starts from 1001-01-01 00:00. Problem is the day starts from 1 day but I would like to have it from 0 days. When I subtract day with -1 I get day 30. $data['duration'] = date('d -…
marhyno
  • 677
  • 1
  • 8
  • 20
-4
votes
2 answers

Create first Instant of year 2022

I have an int representing the year 2022, and I want to create an Instant object representing the first instant of the year, meaning: 2022-01-01 00:00:00. int year = 2022; Instant instant = ... How can we do that in java 8?
-4
votes
2 answers

What is the cleanest way to strip leading 0s from the day-of-month portion of dates?

I have this code that shows some build info in an About box: private void frmAbout_Load(object sender, EventArgs e) { Version versionInfo = Assembly.GetExecutingAssembly().GetName().Version; lblVersion.Text = String.Format("Version…
1 2 3 4 5
6